home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 440_01 / !bestlib.doc < prev    next >
Text File  |  1994-09-11  |  303KB  |  6,549 lines

  1. ================================================================================
  2. =------------                THE BEST LIBRARY 2.32                 ------------=
  3. =------------   THE FASTEST AND MOST EFFICIENT LIBRARY AVAILABLE   ------------=
  4. =------------------------------------------------------------------------------=
  5. =----------------------  292 PURE ASSEMBLER FUNCTIONS   -----------------------=
  6. =----------------------       68 C CODED ROUTINES       -----------------------=
  7. =----------------------                                 -----------------------=
  8. =----------------------      TOTAL: 360 FUNCTIONS       -----------------------=
  9. ================================================================================
  10.  
  11.                     DOCUMENT LAST UPDATED  94/09/11   Sunday, September 11, 1994
  12.                 INDEPENDENTLY AUTHORED BY  GEORGE VANOUS                23:31.39
  13.  
  14.  
  15. If you find this library useful, please let me know.  I like hearing that my
  16. efforts are appreciated.
  17.  
  18. You can contact me via email: vanous@helix.net
  19. or call me at (604)589-2675 or write to me:  George Vanous
  20.                                              8930 Watson Court
  21.                                              Delta, BC
  22.                                              V4C 4T6
  23.  
  24. NOTE  This library will no longer be updated, since C is quickly being
  25.       replaced by C++.  The BESTLibrary++ 1.0 will soon be released, an
  26.       object version of The BESTLibrary 2.32.  As of today, it contains full
  27.       support for 2D AND 3D rotation/scaling, timing classes, and text mode
  28.       windowing classes, to mention a few.  Let me know if you are interested
  29.       in obtaining the demo .EXE of what it can currently do.
  30.  
  31.  
  32. This library covers the following categories:
  33.  
  34.       FILE           8 functions             TEXT          33 functions
  35.         INI FILE     9 functions               ANIMATION    0 functions
  36.       KEYBOARD      42 functions               ATTRIBUTE    8 functions
  37.       LINKED LIST    4 functions               CHARACTER   16 functions
  38.       MATH          13 functions               CURSOR      23 functions
  39.         MATRIX      18 functions               GET          5 functions
  40.         2D VECTORS  17 functions               STRING       8 functions
  41.         3D VECTORS  17 functions               WINDOW       4 functions
  42.       MISCELLANEOUS  9 functions             VGA                3 functions
  43.       MOUSE         13 functions             VGA16             17 functions
  44.       STRING        73 functions               ANIMATION        4 functions
  45.         CHARACTER   15 functions               IMAGE            1 function
  46.         CONVERSION   4 functions               COMPRESS IMAGE  10 functions
  47.                                                PIXEL IMAGE      7 functions
  48.                                                PLANE IMAGE      8 functions
  49.                                              VGA256             2 functions
  50.  
  51.                          TOTAL:  360 ROUTINES
  52.  
  53. --------------------------------------------------------------------------------
  54.  
  55. B - changes in other functions have made this function unusable (temporary)
  56. X - still under development
  57.  
  58.   ----------------------------------------------------------------------------
  59. ------------------------------------ FILE --------------------------------------
  60.  
  61. fil_count...........display the number of executions and some message
  62. fil_count_reg.......same as "counter" except this is used for registered copies
  63. fil_len.............return the length of a file, in bytes
  64. fil_next_str........return the next string from a file
  65. fil_next_word.......return the next word from a file
  66. fil_read_to.........return the contents of a file upto and including a string
  67. fil_read_to_strip...return the contents of a file upto and including a string
  68. fil_skip_past.......skip past a string in a file
  69. fil_skip_to.........skip to a string in a file
  70.  
  71. - - - - - - - - - - - - - - - - -  INI FILE  - - - - - - - - - - - - - - - - - -
  72. ini_get_boolean.....read in a boolean parameter
  73. ini_get_color.......read in a color
  74. ini_get_number......read in a number
  75. ini_get_position....read in and translate a screen position into a row number
  76. ini_get_rows........read in the number of rows per screen
  77. ini_get_state.......read in the keyboard state
  78. ini_get_text........read in a text string
  79. ini_get_yesno.......read in a YES or NO response
  80. ini_read_section....read in the releveant text of a section
  81.  
  82.   ----------------------------------------------------------------------------
  83. ---------------------------------  KEYBOARD  -----------------------------------
  84.  
  85. kbd_all_off.............disable all of the three LOCKS and turns off light
  86. kbd_all_on..............enable  all of the three LOCKS and turns on  light
  87. kbd_caps_off............disable the CAPS LOCK key and turns off the light
  88. kbd_caps_on.............enable  the CAPS LOCK key and turns on  the light
  89. kbd_clear...............clear the keyboard buffer of all keystrokes
  90. kbd_give................give control back to the original keyboard interrupt
  91. kbd_hit.................check keyboard buffer to see if a key has been pressed
  92. kbd_insert_off..........disable the INSERT mode
  93. kbd_insert_on...........enable  the INSERT mode
  94. kbd_is_all_on...........report if all three LOCKS are active
  95. kbd_is_alt..............report if either alt is depressed
  96. kbd_is_alt_left.........report if the left alt is depressed
  97. kbd_is_alt_left_only....report if only the left alt is depressed
  98. kbd_is_alt_right........report if the right alt is depressed
  99. kbd_is_alt_right_only...report if only the right alt is depressed
  100. kbd_is_alt_only.........report if only an alt is depressed (not ctrl or shift)
  101. kbd_is_caps_on..........report if CAPS LOCK is active
  102. kbd_is_ctrl.............report if either ctrl is depressed
  103. kbd_is_ctrl_left........report if the left ctrl is depressed
  104. kbd_is_ctrl_left_only...report if only the left ctrl is depressed
  105. kbd_is_ctrl_right.......report if the left ctrl is depressed
  106. kbd_is_ctrl_right_only..report if only the right ctrl is depressed
  107. kbd_is_ctrl_only........report if only ctrl is depressed (and not alt or shift)
  108. kbd_is_insert_on........report if INSERT is active
  109. kbd_is_num_on.. ........report if NUM LOCK is active
  110. kbd_is_scroll_on........report if SCROLL LOCK is active
  111. kbd_is_shift............report if either shift is depressed
  112. kbd_is_shift_left.......report if the left shift is depressed
  113. kbd_is_shift_left_only..report if only the left shift is depressed
  114. kbd_is_shift_right......report if the right shift is depressed
  115. kbd_is_shift_right_only.report if only the right shift is depressed
  116. kbd_is_shift_only.......report if only shift is depressed (and not alt or ctrl)
  117. kbd_num_off.............disable the NUM LOCK key and turns off the light
  118. kbd_num_on..............enable  the NUM LOCK key and turns on  the light
  119. kbd_rate................set typematic rate and delay for repeat-key action
  120. kbd_scroll_off..........disable the SCROLL LOCK key and turns off the light
  121. kbd_scroll_on...........enable  the SCROLL LOCK key and turns on  the light
  122. kbd_status_load.........restore the previously saved keyboard status
  123. kbd_status_save.........save the keyboard status of insert, caps/num/scroll lock
  124. kbd_take................take control of the keyboard interrupt
  125. getchr..................get a character from the keyboard buffer
  126. getchre.................same as getchr, but also echoes character to the screen
  127.  
  128.   ----------------------------------------------------------------------------
  129. --------------------------------  LINKED LIST  ---------------------------------
  130.  
  131. lst_find............search for a node of a linked list
  132. lst_free_double.....deallocate each node of a doubly linked list
  133. lst_free_single.....deallocate each node of a singly linked list
  134. lst_tail............return the tail of a linked list
  135. lst_unlink_double...unlink a node from a doubly linked list
  136. lst_unlink_single...unlink a node from a singly linked list
  137.  
  138.   ----------------------------------------------------------------------------
  139. -----------------------------------  MATH  -------------------------------------
  140.  
  141. max_byte............return the maximum of a list of byte
  142. max_int.............return the maximum of a list of integers
  143. max_shortint........return the maximum of a list of short integers
  144. max_word............return the maximum of a list of words
  145. min_byte............return the minimum of a list of bytes
  146. min_int.............return the minimum of a list of integers
  147. min_shortint........return the minimum of a list of short integers
  148. min_word............return the minimum of a list of words
  149.  
  150. - - - - - - - - - - - - - - - - - - MATRIX - - - - - - - - - - - - - - - - - - -
  151. m3_add..............add two 3x3 matrices
  152. m3_copy.............return a copy of a 3x3 matrix
  153. m3_det............X.return the determinant of a 3x3 matrix
  154. m3_div............X.divide two 3x3 matrices
  155. m3_inv............X.return the inverse of a 3x3 matrix
  156. m3_mul..............multiply two 3x3 matrices
  157. m3_new..............create and initialize a new 3x3 matrix
  158. m3_sub..............subtract two 3x3 matrices
  159. m3_transpose........transpose a 3x3 matrix
  160. m4_add..............add two 4x4 matrices
  161. m4_copy.............return a copy of a 4x4 matrix
  162. m4_det............X.return the determinant of a 4x4 matrix
  163. m4_div............X.divide two 4x4 matrices
  164. m4_inv............X.return the inverse of a 4x4 matrix
  165. m4_mul..............multiply two 4x4 matrices
  166. m4_new..............create and initialize a new 4x4 matrix
  167. m4_sub..............subtract two 4x4 matrices
  168. m4_transpose........transpose a 4x4 matrix
  169.  
  170. - - - - - - - - - - - - - - - - - 2D VECTORS - - - - - - - - - - - - - - - - - -
  171. v2_add..............add two 2D vector
  172. v2_combine..........return the linear combination of two 2D vectors
  173. v2_copy.............return a copy of a 2D vector
  174. v2_dot..............return the dot product of two 2D vectors
  175. v2_len..............return the magnitude (length) of 2D vector
  176. v2_len_sqr..........return the magnitude (length) of 2D vector squared
  177. v2_lerp.............linearly interpolate between two 2D vectors by some amount
  178. v2_mul..............multiply two 2D vectors component-wise
  179. v2_mul_by_matrix..X.multiply a 2D point by a matrix
  180. v2_mul_by_proj......multiply a 2D point by a projection matrix
  181. v2_neg..............negate a 2D vector
  182. v2_new..............create and initialize a new 2D vector
  183. v2_norm.............normalize a 2D vector (becomes unit length)
  184. v2_ortho............return some orthogonal 2D vector to a 2D vector
  185. v2_scale............scale a 2D vector to some new length
  186. v2_seg_len..........return distance (line segment length) between two 2D points
  187. v2_sub..............subtract two 2D vectors
  188.  
  189. - - - - - - - - - - - - - - - - - 3D VECTORS - - - - - - - - - - - - - - - - - -
  190. v3_add..............add two 3D vector
  191. v3_combine..........return the linear combination of two 3D vectors
  192. v3_copy.............return a copy of a 3D vector
  193. v3_cross............return the cross product of two 3D vectors
  194. v3_dot..............return the dot product of two 3D vectors
  195. v3_len..............return the magnitude (length) of 3D vector
  196. v3_len_sqr..........return the magnitude (length) of 3D vector squared
  197. v3_lerp.............linearly interpolate between two 3D vectors by some amount
  198. v3_mul..............multiply two 3D vectors component-wise
  199. v3_mul_by_matrix....multiply a 3D point by a matrix
  200. v3_mul_by_proj......multiply a 3D point by a projection matrix
  201. v3_neg..............negate a 3D vector
  202. v3_new..............create and initialize a new 3D vector
  203. v3_norm.............normalize a 3D vector (becomes unit length)
  204. v3_ortho..........X.return some orthogonal 3D vector to a 3D vector
  205. v3_scale............scale a 3D vector to some new length
  206. v3_seg_len..........return distance (line segment length) between two 3D points
  207. v3_sub..............subtract two 3D vectors
  208.  
  209.   ----------------------------------------------------------------------------
  210. -------------------------------  MISCELLANEOUS    --------------------------------
  211.  
  212. beep................beeps the speaker
  213. bestlib_init........initialize THE BEST LIBRARY and set default values
  214. boot................either warm of cold boot the system
  215. dos_shell...........shells to DOS, returning upon the user typing "EXIT"
  216. msec................delays the computer for a specific number of milliseconds
  217. sound_off...........stops any sound coming from the speaker
  218. stopw...............set a delay stopwatch to a specific clock-tick delay
  219. video_get...........read the current video mode
  220. video_set...........change the video mode
  221.  
  222.   ----------------------------------------------------------------------------
  223. -----------------------------------  MOUSE  ------------------------------------
  224.  
  225. ms_get..............store the location of the mouse cursor
  226. ms_getx.............return the mouse cursor abscissa
  227. ms_gety.............return the mouse cursor ordinate
  228. ms_hide.............hides the mouse cursor
  229. ms_init.............initialize the mouse and set "mousedata" values to default
  230. ms_kill.............completely disable the mouse driver
  231. ms_range............set the mouse cursor's minimum and maximum range of movement
  232. ms_set..............set the mouse cursor's abscissa and ordinate
  233. ms_setx.............set the mouse cursor's abscissa
  234. ms_sety.............set the mouse cursor's ordinate
  235. ms_shape............change the mouse character in text mode
  236. ms_show.............display the mouse cursor
  237. ms_stat.............store detailed information about the mouse's status
  238.  
  239.   ----------------------------------------------------------------------------
  240. ----------------------------------  STRING  ------------------------------------
  241.  
  242. case_down...........return an UPPERCASE letter as lowercase
  243. case_down_ptr.......convert an UPPERCASE letter to lowercase
  244. case_flip...........return the opposite case of a letter
  245. case_flip_ptr.......convert a letter to the opposite case
  246. case_up.............return a lowercase letter as UPPERCASE
  247. case_up_ptr.........convert a lowercase letter to UPPERCASE
  248. is_number_dec.......check if a string is a decimal number
  249. is_number_hex.......check if a string is a hexadecimal number
  250. mem_copy............makes a copy of a memory location
  251. scan_byte...........search for a one-byte value
  252. scan_byte_not.......search for any other one-byte value
  253. scan_bytes..........search for one of several one-byte values
  254. scan_bytes_not......search for any other one-byte values
  255. scan_str............search for a string of characters
  256. scan_str_not......X.search for any other string of characters
  257. scan_strs.........X.search for one of several strings of characters
  258. scan_strs_not.....X.search for any other string of characters
  259. scan_word...........search for a one-word (two-byte) value
  260. scan_word_not.......search for any other one-word (two-byte) value
  261. scan_words..........search for one of several one-word (two-byte) values
  262. scan_words_not......search for any other one-word (two-byte) value
  263. sign................return the sign of a number
  264. str_add...........X.adds to a number stored as an ASCII string
  265. str_case_down.......convert all characters in a string to lowercase
  266. str_case_down_pr....convert all characters in "prdata.string" to lowercase
  267. str_case_flip.......convert all characters in a string to the opposite case
  268. str_case_flip_pr....convert all characters in "prdata.string" to opposite case
  269. str_case_up.........convert all characters in a string to uppercase
  270. str_case_up_pr......convert all characters in "prdata.string" to uppercase
  271. str_cmp.............compares two strings for equality
  272. str_copy............copies a string
  273. str_dec.............decrements a number stored as an ASCII string
  274. str_del_byte........delete all occurrences of a byte from a string
  275. str_del_bytes.......delete bytes from a string
  276. str_del_str.......X.delete all occurences of a string from a string
  277. str_del_word........delete all occurrences of a word from a word-value array
  278. str_del_words.......delete word from an array of word-values
  279. str_div...........X.divides a number stored as an ASCII string
  280. str_fill_byte.......fill memory with a one-byte value
  281. str_fill_str........fill memory with a string of characters
  282. str_fill_word.......fill memory with a one-word (two-byte) value
  283. str_inc.............increments a number stored as an ASCII string
  284. str_ins_byte........insert a one-byte value into a string
  285. str_ins_str.........insert a string of characters into a string
  286. str_ins_word........insert a one-word (two-byte) value into an array of words
  287. str_len.............return the length of a string
  288. str_len_pr..........return the length of "prdata.string"
  289. str_mul...........X.multiplies a number stored as an ASCII string
  290. str_next_str........return the next string from a string
  291. str_next_word.......return the next word from a string
  292. str_rep_byte_byte...search for a byte and replaces it with a different byte
  293. str_rep_byte_word...search for a byte and replaces it with a word
  294. str_rep_byte_str....search for a byte and replaces it with a string
  295. str_rep_str_byte....search for a string and replaces it with a byte
  296. str_rep_str_str.....search for a string and replaces it with another string
  297. str_rep_word_byte...search for a word and replaces it with a byte
  298. str_rep_word_word...search for a word and replaces it with a different word
  299. str_right...........read one string character, counting from the right
  300. str_right_pr........read one "prdata.string" character, counting from the right
  301. str_sub...........X.subtracts from a number stored as an ASCII string
  302.  
  303. - - - - - - - - - - - - - - - - -  CHARACTER - - - - - - - - - - - - - - - - - -
  304. is_alpha............check if a character is an alphabet letter
  305. is_alpha_down.......check if a character is a lowercase alphabet letter
  306. is_alpha_up.........check if a character is an uppercase alphabet letter
  307. is_alphanum.........check if a character is an alphanumeric character
  308. is_ascii............check if a character is a standard ASCII character
  309. is_case_down........check if a character is a lowercase letter
  310. is_case_up..........check if a character is an uppercase letter
  311. is_ctrlchar.........check if a character is a control character (0-31 or 127)
  312. is_digit_dec........check if a character is a decimal digit
  313. is_digit_hex........check if a character is a hexadecimal digit
  314. is_letter...........check if a character is an alphabet letter, ', or -
  315. is_letternum........check if a character is an alphanumeric letter, ', or -
  316. is_greek............check if a character is a greek letter
  317. is_print............check if a character is a printable character (ASCII symbol)
  318. is_punc.............check if a character is a punctuation character
  319.  
  320. - - - - - - - - - - - - - - - - - CONVERSION - - - - - - - - - - - - - - - - - -
  321. con_bool_to_str.....convert a numerical boolean value into its string equivalent
  322. con_color_to_str....convert a numerical color value into its string equivalent
  323. con_str_to_bool.....convert a boolean word into its numerical equivalent
  324. con_str_to_color....convert a color name into its numerical equivalent
  325.  
  326.   ----------------------------------------------------------------------------
  327. -----------------------------------  TEXT  -------------------------------------
  328.  
  329. txt_ascii_get..,,.X.read in ASCII character patterns
  330. txt_ascii_set.......redefine ASCII character patterns to allow for new characters
  331. txt_blink...........set 16 background colors or blinking characters
  332. txt_char_height.....return the height of text mode characters (in pixels)
  333. txt_char_length.....return the length of text mode characters (in pixels)
  334. txt_cls.............clear the screen
  335. txt_erase...........overwrite a region of characters with spaces
  336. txt_erase_col.......overwrite one column of characters with spaces
  337. txt_erase_row.......overwrite one row of characters with spaces
  338. txt_fill_area.......fill a screen region according to the structure "fidata"
  339. txt_fill_col........fill a screen column with a string in a defined color
  340. txt_fill_row........fill a screen row with a string in a defined color
  341. txt_flood...........flood the screen with a character in a fg/bg color
  342. txt_get_abs.........return the absolute address of the text page
  343. txt_get_act.........return the active text page
  344. txt_get_vis.........return the visual text page
  345. txt_last............return the last text page
  346. txt_mem.............store or restore the text screen
  347. txt_print...........print to the text screen according to the structure "prdata"
  348. txt_rows............return the [number of rows per page]-1
  349. txt_scroll..........smoothly scrolls, in any direction, the entire screen
  350. txt_scroll_fast.....quickly smoothly scrolls (may be some flicker) the screen
  351. txt_scroll_off....X.smoothly scrolls the screen off in a direction
  352. txt_scroll_on.....X.smoothly scrolls a screen on in a direction
  353. txt_scroll_over.....smoothly scrolls a screen overtop another screen
  354. txt_scroll_rows.....smoothly scrolls certain rows
  355. txt_scroll_window.X.smoothly scrolls, in any direction, a window of the screen
  356. txt_set_abs.........set the absolute offset of the text page
  357. txt_set_act.........set the active text page
  358. txt_set_rel.........set the relative offset of the text page
  359. txt_set_vis.........set the visual text page
  360. txt_split...........split the visual screen into two mirror images
  361.  
  362. - - - - - - - - - - - - - - - - -  ANIMATION - - - - - - - - - - - - - - - - - -
  363. NONE YET :(
  364.  
  365. - - - - - - - - - - - - - - - - -  ATTRIBUTE - - - - - - - - - - - - - - - - - -
  366. txt_attr_save.......save one attribute
  367. txt_attr_show.......print a specific number of one attribute
  368. txt_attrs_fill......fill a screen region with a foreground and background color
  369. txt_attrs_need......return memory requirement for a "txt_attrs_save"ed image
  370. txt_attrs_save......read a region of attributes
  371. txt_attrs_show......print a region of attributes
  372. txt_attrs_show_char...X.print only one attribute from a region of attributes
  373. txt_attrs_show_str....X.print only one string of attributes from a region
  374. txt_attrs_show_region.X.print only one region from a region of attributes
  375. txt_bg_get..........save the background color at specified coordinates
  376. txt_fg_get..........save the foreground color at specified coordinates
  377.  
  378. - - - - - - - - - - - - - - - - -  CHARACTER - - - - - - - - - - - - - - - - - -
  379. txt_chr_attr_save...save a character and its attribute
  380. txt_chr_attr_show...print a specific number of one character in a defined color
  381. txt_chr_erase.......overwrite a specific number of characters with spaces
  382. txt_chr_get.........read one character
  383. txt_chr_show........print a specific number of one character
  384. txt_chrattr_save....read a character with its attribute
  385. txt_chrattr_show....print a specific number of characters with attributes
  386. txt_chrattrs_fill...fill a screen region with a fg/bg color and a character
  387. txt_chrattrs_need...return memory requirement for "txt_chrattrs_save"ed image
  388. txt_chrattrs_save...read a region of characters with their attributes
  389. txt_chrattrs_show...print a region of characters with their attributes
  390. txt_chrattrs_show_char.....print only one character from a region
  391. txt_chrattrs_show_str......print only a string of characters from a region
  392. txt_chrattrs_show_region.X.print only a region from a region
  393. txt_chrs_erase......overwrite a "textimagedata"ed image with spaces
  394. txt_chrs_fill.......fill a screen with with a character
  395. txt_chrs_need.......return the memory requirement for a "txt_chrs_save"ed image
  396. txt_chrs_save.......read a region of characters
  397. txt_chrs_show.......print a region of characters
  398. txt_chrs_show_char...X.print only one character from a region of characters
  399. txt_chrs_show_str....X.print only one string of characters from a region
  400. txt_chrs_show_region.X.print only one region from a region of characters
  401.  
  402. - - - - - - - - - - - - - - - - - - CURSOR - - - - - - - - - - - - - - - - - - -
  403. cur_get_coord.......store the cursor location
  404. cur_get_coord_abs...store the cursor location as reported by the VGA card
  405. cur_get.............store all cursor information
  406. cur_get_abs.........store all cursor information as reported by the VGA card
  407. cur_get_x...........return the cursor abscissa
  408. cur_get_x_abs.......return the cursor abscissa as reported by the VGA card
  409. cur_get_y...........return the cursor ordinate
  410. cur_get_y_abs.......return the cursor ordinate as reported by the VGA card
  411. cur_is_on...........check if the cursor is on
  412. cur_off.............turns cursor off
  413. cur_on..............turns cursor on
  414. cur_set.............set all the cursor's statistics
  415. cur_set_bios........set all the cursor's statistics via BIOS
  416. cur_set_coord.......set the cursor's abscissa and ordinate
  417. cur_set_coord_bios..set the cursor's abscissa and ordinate via BIOS
  418. cur_get_shape.......store the cursor's shape on the active page
  419. cur_get_shape_abs...store the cursor's shape as reported by the VGA card
  420. cur_set_shape.......define a new cursor shape on the active page
  421. cur_set_shape_bios..define a new cursor shape on the active page via BIOS
  422. cur_set_x...........set the cursor's abscissa
  423. cur_set_x_bios......set the cursor's abscissa via BIOS
  424. cur_set_y...........set the cursor'r ordinate
  425. cur_set_y_bios......set the cursor's ordinate via BIOS
  426.  
  427. - - - - - - - - - - - - - - - - - - - GET  - - - - - - - - - - - - - - - - - - -
  428. txt_get_let.........prompts the user for input -- accepts only alphabet letters
  429. txt_get_num.........prompts the user for input -- accepts only digits and signs
  430. txt_get_numu........prompts the user for unsigned input -- accepts only digits
  431. txt_get_numl......X.prompts user for long input -- accepts only digits and signs
  432. txt_get_numlu.....X.prompts user for unsigned long input -- accepts only digits
  433. txt_get_str.........prompts the user for input -- accepts all ASCII characters
  434.  
  435. - - - - - - - - - - - - - - - - - - STRING - - - - - - - - - - - - - - - - - - -
  436. txt_str_attr_show...print a string with attributes
  437. txt_str_erase.......overwrite a string with spaces
  438. txt_str_erase_pr....overwrite "prdata.string" with spaces
  439. txt_str_save........read a string from the text screen
  440. txt_str_show........print a string
  441. txt_strattr_need....return memory requirement for a "txt_strattr_save"ed image
  442. txt_strattr_save....read a string with its attributes from the text screen
  443. txt_strattr_show....print a "txt_strattr_save"ed string with its attributes
  444.  
  445. - - - - - - - - - - - - - - - - - - WINDOW - - - - - - - - - - - - - - - - - - -
  446. win_define..........define a new window
  447. win_move............move a window to absolute coordinates
  448. win_move_rel........move a window relative to its current position
  449. win_scroll..........scrolls a window
  450.  
  451.   ----------------------------------------------------------------------------
  452. ------------------------------------  VGA  -------------------------------------
  453.  
  454. fade_in.............fade into a screen
  455. fade_out............fade a screen out to black
  456. isit_color..........check if current display adapter is color capable
  457. isit_ega............check if current display adapter is EGA capable
  458. isit_vga............check if current display adapter is VGA capable
  459. isit_svga.........X.check if current display adapter is SuperVGA capable
  460.  
  461.   ----------------------------------------------------------------------------
  462. -----------------------------------  VGA16  ------------------------------------
  463.  
  464. _16_boxfill.........draw a solid box
  465. _16_boxfillxy.....X.draw a solid box
  466. _16_boxoutline......draw a box outline
  467. _16_boxoutlinexy..X.draw a box outline
  468. _16_floodall........flood the screen all one color
  469. _16_floodallall.....flood a 640x816 region of video memory all one color
  470. _16_linebiglen....X.draw a line using a specific block size
  471. _16_linebigxy.......draw a line using a specific block size
  472. _16_linelen.........draw a line
  473. _16_linexy..........draw a line
  474. _16_pixel...........change the color of a pixel
  475. _16_pixel_avg.......return the average color of nine pixels surrounding a point
  476. _16_pixel_color.....read the color of a pixel
  477. _16_pixel_is........check if a specific pixel is a specific color
  478. _16_popupcolumn.....same as "popupmenu" except only one column is used
  479. _16_popupmenu.......creates a menu system in graphics mode
  480. _16_scrollevel......read the number of rows currently scrolled
  481. _16_scrollrow.......scrolls a specific number of rows
  482. _16_thermal.........generate a thermal equilibrium style spread
  483.  
  484. - - - - - - - - - - - - - - - - -  ANIMATION - - - - - - - - - - - - - - - - - -
  485. _16_animat_rect...B.animate any solid rectangular "_16_i_save"ed image
  486. _16_i_move........B.move any "_16_i_save"ed image
  487. _16_move..........X.move using true 32-bit data transfers
  488. _16_p_move........B.move any "_16_p_save"ed image
  489.  
  490. - - - - - - - - - - - - - - - - - -  IMAGE - - - - - - - - - - - - - - - - - - -
  491. _16_copy............copy any "_16_c_save"ed/"_16_i_save"ed/"_16_p_save"ed image
  492.  
  493. - - - - - - - - - - - - - - - - COMPRESS IMAGE - - - - - - - - - - - - - - - - -
  494. _16_c_move........B.move any "_16_c_save"ed image
  495. _16_c_need_scrn.....memory need for any screen image that is to be "_16_c_save"ed
  496. _16_c_need_wrst.....worst-case compression for a theoretical "_16_c_save"ed image
  497. _16_c_percent.......calculate how much percent smaller a "_16_c_save"ed image is
  498. _16_c_read_off....X.read a pixel color of any "_16_c_save"ed image by offset
  499. _16_c_read_xy.....X.read a pixel color of any "_16_c_save"ed image by (x,y)
  500. _16_c_save..........store an image into memory from the screen using compression
  501. _16_c_show..........write any "_16_c_save"ed image to the screen
  502. _16_i_to_c........X.convert any "_16_i_save"ed image to a "_16_c_save"ed image
  503. _16_p_to_c........X.convert any "_16_p_save"ed image to a "_16_c_save"ed image
  504.  
  505. - - - - - - - - - - - - - - - - - PIXEL IMAGE  - - - - - - - - - - - - - - - - -
  506. _16_c_to_p........X.convert any "_16_c_save"ed image to a "_16_p_save"ed image
  507. _16_i_to_p........X.convert any "_16_i_save"ed image to a "_16_p_save"ed image
  508. _16_p_need..........calculate the memory requirement of any "_16_p_save"ed image
  509. _16_p_save..........store an image from the screen on a pixel by pixel algorithm
  510. _16_p_read_off......read a pixel color of any "_16_p_save"ed image by offset
  511. _16_p_read_xy.......read a pixel color of any "_16_c_save"ed image by (x,y)
  512. _16_p_show..........write any "_16_p_save"ed image to the screen
  513.  
  514. - - - - - - - - - - - - - - - - - PLANE IMAGE  - - - - - - - - - - - - - - - - -
  515. _16_c_to_i........X.convert any "_16_c_save"ed image to a "_16_i_save"ed image
  516. _16_i_need..........calculate the memory requirement of any "_16_i_save"ed image
  517. _16_i_read_off......read a pixel color of any "_16_i_save"ed image by offset
  518. _16_i_read_xy.......read a pixel color of any "_16_c_save"ed image by (x,y)
  519. _16_i_save..........store an image from the screen on a plane by plane algorithm
  520. _16_i_show..........write any "_16_i_save"ed image to the screen
  521. _16_p_to_i..... ..X.convert any "_16_p_save"ed image to a "_16_i_save"ed image
  522. _16_restore_bg......restore from RAM a region of the screen background
  523.  
  524.   ----------------------------------------------------------------------------
  525. ------------------------------------ VGA256 ------------------------------------
  526.  
  527. _256_floodall.......flood the screen all one color
  528. _256_pixel..........change the color of a pixel
  529.  
  530. --------------------------------------------------------------------------------
  531.  
  532.  
  533. ================================================================================
  534. ====================  BEGINNING OF LIBRARY DOCUMENTATION  ======================
  535. ================================================================================
  536.  
  537.                             !!! IMPORTANT NOTES !!!
  538.  
  539. *** NOTE  all functions in THE BEST LIBRARY require FAR calls -- if you are
  540.           using a C compiler, set it to the Large Memory Model
  541.  
  542. *** NOTE  these variables need to be declared globally:
  543.             asciiscan  keyp;    /* global structure "keyp"   */
  544.             cursordata cursor;  /* global structure "cursor" */
  545.             mousedata  msdata;  /* global structure "msdata" */
  546.  
  547. *** NOTE  a VGA display is assumed by all functions
  548.  
  549. *** NOTE  abscissa refers to x-coordinate and ordinate refers to y-coordinate
  550.  
  551. *** NOTE  if the speaker beeps unexpectedly, something illegal was attempted
  552.           (ie. if "str_show" is not passed a NULL-terminated string)
  553.  
  554. *** NOTE  when allocating memory for strings, always remember to allocate
  555.           [the length of the largest string] + 1 bytes
  556.           (ex. for an 8 character maximum input into string "str":
  557. str = (char *) malloc(9);                    /* [maximum length of input] + 1 */
  558. txt_get_let(TCUR, TCUR, str, 8, '_', "What is your name? ", WHITE, BLUE, "Ted");
  559.           will print  What is your name? Ted_____ at the current text cursor
  560.           coordinates (TCUR, TCUR) and position the cursor under the T in Ted
  561.           (Ted is the default name); a maximum of eight characters will be
  562.           accepted
  563.  
  564. *** NOTE  all video output functions check the global variable "mousepresent"
  565.           defined by mouse unit; if it is FALSE, the mouse cursor is ignored
  566.           and if it is TRUE, the mouse cursor is hidden before performing any
  567.           video output and shown again after the function finishes
  568.  
  569. *** NOTE  all video output (text and graphics modes) is performed with direct
  570.           screen writes (the BIOS is not used) unless otherwise stated
  571.  
  572. *** NOTE  all coordinates are (0,0) - (MAXX-1, MAXY-1)
  573.           - the text screen is usually 80x25, so the coordinates would be
  574.             (0,0) - (79,24)
  575.           - the VGA graphic screen is usually 640x480, so the coordinates
  576.             would be (0,0) - (639,479)
  577.  
  578. *** NOTE  each text page has its own cursor position and cursor shape
  579.  
  580. *** NOTE  the cursor position is not modified by a function unless stated in
  581.           the description of that function
  582.  
  583. *** NOTE  all functions that use the cursor use the cursor on the active text
  584.       page and not the visual text page (make the active text page the
  585.       same as the visual text page to operate on the visual text page)
  586.  
  587. *** NOTE  those parameters that ask for an "x" and a "y" will accept TCUR or
  588.           MCUR, as described:
  589.           - if "x" = TCUR, the text cursor abscissa is used
  590.                    = MCUR, the mouse cursor abscissa is used
  591.           - if "y" = TCUR, the text cursor ordinate is used
  592.                    = MCUR, the mouse cursor ordinate is used
  593.           in addition, some functions also accept MEM, which is explicity
  594.           stated in the function's description
  595.  
  596. *** NOTE  those parameters that ask for a "length" and a "height" will accept
  597.           negative numbers (to mean opposite direction)
  598.           - positive "length" is to the right whereas negative is to the left
  599.           - positive "height" is downward whereas negative is upward
  600.           - ex: /* both draw the same box */
  601.                 boxfill(10, 10, 5, 5, YELLOW, COPY_IMAGE);
  602.                 boxfill(14, 14, -5, -5, YELLOW, COPY_IMAGE);
  603.  
  604. *** NOTE  all graphic images have a maximum size of exactly 65517 bytes
  605.  
  606. *** NOTE  all strings have a maximum length of 65531 characters
  607.  
  608. *** NOTE  some functions directly correspond to those offered by your compiler;
  609.           the functions provided in THE BEST LIBRARY are more efficient and
  610.           should be used over the compiler's functions
  611.  
  612. *** NOTE  the few functions that are still under development may be completed
  613.           by the time you are reading this text; call me, George Vanous, at
  614.           the phone number listed at the end of this document to verify the
  615.           status of these functions
  616.  
  617. *** NOTE  if you have any questions or comments, feel free to contact me by
  618.           phone or mail
  619.  
  620. *** NOTE  see !BESTLIB.H for a more brief description of every function
  621.  
  622. ==========================--------------------------============================
  623. ----------------------------  GLOBAL DEFINITIONS  ------------------------------
  624.                           --------------------------
  625. /* COLOR DEFINITIONS */
  626.  
  627. BLACK.................... 0x0  0
  628. BLUE..................... 0x1  1
  629. GREEN.................... 0x2  2
  630. CYAN..................... 0x3  3
  631. RED...................... 0x4  4
  632. MAGENTA.................. 0x5  5
  633. BROWN.................... 0x6  6
  634. LIGHTGREY................ 0x7  7
  635. DARKGREY................. 0x8  8
  636. LIGHTBLUE................ 0x9  9
  637. LIGHTGREEN............... 0xA  10
  638. LIGHTCYAN................ 0xB  11
  639. LIGHTRED................. 0xC  12
  640. LIGHTMAGENTA............. 0xD  13
  641. YELLOW................... 0xE  14
  642. WHITE.................... 0xF  15
  643. BLINKCHAR................ 0x8  value to add to background color for blinking
  644.  
  645. --------------------------------------------------------------------------------
  646.  
  647. /* NUMBER DEFINITIONS */
  648.  
  649. ZERO.................... 0x00  0
  650. ONE..................... 0x01  1
  651. TWO..................... 0x02  2
  652. THREE................... 0x03  3
  653. FOUR.................... 0x04  4
  654. FIVE.................... 0x05  5
  655. SIX..................... 0x06  6
  656. SEVEN................... 0x07  7
  657. EIGHT................... 0x08  8
  658. NINE.................... 0x09  9
  659. TEN..................... 0x0A  10
  660. ELEVEN.................. 0x0B  11
  661. TWELVE.................. 0x0C  12
  662. THIRTEEN................ 0x0D  13
  663. FOURTEEN................ 0x0E  14
  664. FIFTEEN................. 0x0F  15
  665. SIXTEEN................. 0x10  16
  666. SEVENTEEN............... 0x11  17
  667. EIGHTEEN................ 0x12  18
  668. NINETEEN................ 0x13  19
  669. TWENTY.................. 0x14  20
  670.  
  671. PI...................... 3.141593  the venerable pi
  672. PIx2.................... 6.283185  2 * pi
  673. PIx4.................... 12.56637  4 * pi
  674. PIby2................... 1.570796  pi / 2 (180 degrees)
  675. PIby3................... 1.047197  pi / 3 ( 60 degrees)
  676. PIby4................... 0.785398  pi / 4 ( 45 degrees)
  677. PIby6................... 0.523599  pi / 6 ( 30 degrees)
  678. E....................... 2.718282  the venerable e
  679. SQRT2................... 1.414214  sqrt(2)
  680. SQRT3................... 1.732051  sqrt(3)
  681. GOLDEN.................. 1.618034  the golden ratio
  682. DtoR.................... 0.017453  convert degrees to radians
  683. RtoD.................... 57.29578  convert radians to degrees
  684.  
  685.  
  686. --------------------------------------------------------------------------------
  687.  
  688. /* GENERAL-PURPOSE DEFINITIONS */
  689.  
  690. CR....................... '\r' carriage return character
  691. LF....................... '\n' linefeed character
  692. NO........................ -1  logical constant
  693. YES....................... +1  logical constant
  694. NONE......................  0  logical constant
  695. OFF.......................  0  logical constant
  696. ON........................ +1  logical constant
  697. BOTH...................... +2  logical constant
  698. UNMODIFY.................. +2  logical constant
  699. FALSE...................... 0  logical constant
  700. TRUE.................!(FALSE)  logical constant
  701. BACKWARD.................. -1  logical constant
  702. FORWARD................... +1  logical constant
  703. WARM.................. 0x1234  warm boot identifier (like pressing ctrl-alt-del)
  704. COLD....................... 0  cold boot identifier (like pressing reset button)
  705. MAX....................... -1  logical constant
  706. MIN....................... -2  logical constant
  707. MAXX..................... 640  total screen x-length
  708. MAXXHALF................. 320  half screen x-length
  709. MAXMAXX.................. 640  total (screen)+(virtual screen) x-length
  710. MAXMAXXHALF.............. 320  half (screen)+(virtual screen) x-length
  711. MAXY..................... 480  total screen y-height
  712. MAXYHALF................. 240  half screen y-height
  713. MAXMAXY.................. 816  total (screen)+(virtual screen) y-height
  714. MAXMAXYHALF.............. 408  half (screen)+(virtual screen) y-height
  715. WATCH_MAX................ 100  maximum number of stopwatches
  716. SIGNED.................... -1  signed number
  717. UNSIGNED................... 1  unsigned number
  718. TCUR...................... -1  text cursor
  719. MCUR...................... -2  mouse cursor
  720. MEM....................... -3  memory cursor (coordinates stored in memory)
  721. TEXTSAVE................... 0  store text video memory
  722. TEXTSHOW................... 1  restore text video memory
  723. TEXT....................... 1  text mode
  724. TEXT25..................... 3  25-line text mode
  725. TEXT50..................... 2  50-line text mode
  726. TEXT25F................... -1  forced 25-line text mode
  727. TEXT50F................... -2  forced 50-line text mode
  728. VGA16..................... 18  640x480x16 graphics mode
  729. VGA256.................... 19  320x200x256 graphics mode
  730. TEXTPAGE1.................. 0  text video page 1
  731. TEXTPAGE2.................. 1  text video page 2
  732. TEXTPAGE3.................. 2  text video page 3
  733. TEXTPAGE4.................. 3  text video page 4
  734. TEXTPAGE5.................. 4  text video page 5
  735. TEXTPAGE6.................. 5  text video page 6
  736. TEXTPAGE7.................. 6  text video page 7
  737. TEXTPAGE8.................. 7  text video page 8
  738. TEXTPAGELAST.............. 16  last video page: 4 for 50 lines, 8 for 25 lines
  739. TEXTPAGEACTIVE............ -1  current active text video page
  740. TEXTPAGEVISUAL............ -2  current visual text video page
  741. TEXTIMAGE_OVERHEAD........  8  overhead, in bytes, of "textimagedata"ed objects
  742. TOP.......................  1  top (same as up)
  743. UP........................  1  upward direction
  744. LEFT......................  2  leftward direction
  745. RIGHT.....................  4  rightward direction
  746. DOWN......................  8  downward direction
  747. BOTTOM....................  8  bottom (same as down)
  748. ALIGN_NONE................ -1  perform no alignment when outputting text
  749. ALIGN_HORZ................. 0  horizontal center, shifting odd length left
  750. ALIGN_VERT................. 1  vertical center, shifting odd length up
  751. ALIGN_CENTER............... 2  horizontal and vertical center
  752. ALIGN_RIGHT................ 3  right justify the text
  753. COPY_IMAGE............ 0x0003  hexadecimal code for performing a direct copy
  754. AND_IMAGE............. 0x0803  hexadecimal code for performing a logical AND
  755. OR_IMAGE.............. 0x1003  hexadecimal code for performing a locical OR
  756. XOR_IMAGE............. 0x1803  hexadecimal code for performing an eXclusive OR
  757. COPY_IMAGE_SET........ 0x0013  perform a direct copy and set to scroll
  758. AND_IMAGE_SET......... 0x0813  perform a logical AND and set to scroll
  759. OR_IMAGE_SET.......... 0x1013  perform a locical OR  and set to scroll
  760. XOR_IMAGE_SET......... 0x1813  perform an eXclusive OR and set to scroll
  761.  
  762. --------------------------------------------------------------------------------
  763.  
  764. /* ASCII CODE CONSTANTS */
  765.  
  766. BACKSPACE.................. 0x08 ...  backspace keypress
  767. SPACE...................... 0x20 ...  32
  768. QUOTE...................... 0x22 ...  34
  769. APOSTROPHE................. 0x27 ...  39
  770. HYPHEN..................... 0x2D ...  45
  771. BLOCK_SOLID................ 0xDB ... 219
  772.  
  773. --------------------------------------------------------------------------------
  774.  
  775. /* SCAN CODE CONSTANTS */
  776.  
  777. SCAN_NONE.................. 0x00 ...   0
  778. SCAN_ESC................... 0x01 ...   1
  779. SCAN_1..................... 0x02 ...   2
  780. SCAN_2..................... 0x03 ...   3
  781. SCAN_3..................... 0x04 ...   4
  782. SCAN_4..................... 0x05 ...   5
  783. SCAN_5..................... 0x06 ...   6
  784. SCAN_6..................... 0x07 ...   7
  785. SCAN_7..................... 0x08 ...   8
  786. SCAN_8..................... 0x09 ...   9
  787. SCAN_9..................... 0x0A ...  10
  788. SCAN_0..................... 0x0B ...  11
  789. SCAN_HYPHEN................ 0x0C ...  12
  790. SCAN_EQUAL................. 0x0D ...  13
  791. SCAN_BACKSPACE............. 0x0E ...  14
  792. SCAN_TAB................... 0x0F ...  15
  793. SCAN_Q..................... 0x10 ...  16
  794. SCAN_W..................... 0x11 ...  17
  795. SCAN_E..................... 0x12 ...  18
  796. SCAN_R..................... 0x13 ...  19
  797. SCAN_T..................... 0x14 ...  20
  798. SCAN_Y..................... 0x15 ...  21
  799. SCAN_U..................... 0x16 ...  22
  800. SCAN_I..................... 0x17 ...  23
  801. SCAN_O..................... 0x18 ...  24
  802. SCAN_P..................... 0x19 ...  25
  803. SCAN_BRACKET_LEFT.......... 0x1A ...  26
  804. SCAN_BRACKET_RIGHT......... 0x1B ...  27
  805. SCAN_ENTER................. 0x1C ...  28
  806. SCAN_CTRL.................. 0x1D ...  29
  807. SCAN_A..................... 0x1E ...  30
  808. SCAN_S..................... 0x1F ...  31
  809. SCAN_D..................... 0x20 ...  32
  810. SCAN_F..................... 0x21 ...  33
  811. SCAN_G..................... 0x22 ...  34
  812. SCAN_H..................... 0x23 ...  35
  813. SCAN_J..................... 0x24 ...  36
  814. SCAN_K..................... 0x25 ...  37
  815. SCAN_L..................... 0x26 ...  38
  816. SCAN_SEMICOLON............. 0x27 ...  39
  817. SCAN_QUOTE................. 0x28 ...  40
  818. SCAN_BACKQUOTE............. 0x29 ...  41
  819. SCAN_SHIFT_LEFT............ 0x2A ...  42
  820. SCAN_BACKSLASH............. 0x2B ...  43
  821. SCAN_Z..................... 0x2C ...  44
  822. SCAN_X..................... 0x2D ...  45
  823. SCAN_C..................... 0x2E ...  46
  824. SCAN_V..................... 0x2F ...  47
  825. SCAN_B..................... 0x30 ...  48
  826. SCAN_N..................... 0x31 ...  49
  827. SCAN_M..................... 0x32 ...  50
  828. SCAN_COMMA................. 0x33 ...  51
  829. SCAN_PERIOD................ 0x34 ...  52
  830. SCAN_SLASH................. 0x35 ...  53
  831. SCAN_SHIFT_RIGHT........... 0x36 ...  54
  832. SCAN_KEYPAD_ASTERISK....... 0x37 ...  55
  833. SCAN_ALT................... 0x38 ...  56
  834. SCAN_SPACE................. 0x39 ...  57
  835. SCAN_CAPSLOCK.............. 0x3A ...  58
  836. SCAN_F1.................... 0x3B ...  59
  837. SCAN_F2.................... 0x3C ...  60
  838. SCAN_F3.................... 0x3D ...  61
  839. SCAN_F4.................... 0x3E ...  62
  840. SCAN_F5.................... 0x3F ...  63
  841. SCAN_F6.................... 0x40 ...  64
  842. SCAN_F7.................... 0x41 ...  65
  843. SCAN_F8.................... 0x42 ...  66
  844. SCAN_F9.................... 0x43 ...  67
  845. SCAN_F10................... 0x44 ...  68
  846. SCAN_NUMLOCK............... 0x45 ...  69
  847. SCAN_SCROLLOCK............. 0x46 ...  70
  848. SCAN_HOME.................. 0x47 ...  71
  849. SCAN_UP.................... 0x48 ...  72
  850. SCAN_PGUP.................. 0x49 ...  73
  851. SCAN_KEYPAD_MINUS.......... 0x4A ...  74
  852. SCAN_LEFT.................. 0x4B ...  75
  853. SCAN_KEYPAD_5.............. 0x4C ...  76
  854. SCAN_RIGHT................. 0x4D ...  77
  855. SCAN_KEYPAD_PLUS........... 0x4E ...  78
  856. SCAN_END................... 0x4F ...  79
  857. SCAN_DOWN.................. 0x50 ...  80
  858. SCAN_PGDN.................. 0x51 ...  81
  859. SCAN_INSERT................ 0x52 ...  82
  860. SCAN_DELETE................ 0x53 ...  83
  861. SCAN_SHIFT_F1.............. 0x54 ...  84
  862. SCAN_SHIFT_F2.............. 0x55 ...  85
  863. SCAN_SHIFT_F3.............. 0x56 ...  86
  864. SCAN_SHIFT_F4.............. 0x57 ...  87
  865. SCAN_SHIFT_F5.............. 0x58 ...  88
  866. SCAN_SHIFT_F6.............. 0x59 ...  89
  867. SCAN_SHIFT_F7.............. 0x5A ...  90
  868. SCAN_SHIFT_F8.............. 0x5B ...  91
  869. SCAN_SHIFT_F9.............. 0x5C ...  92
  870. SCAN_SHIFT_F10............. 0x5D ...  93
  871. SCAN_CTRL_F1............... 0x5E ...  94
  872. SCAN_CTRL_F2............... 0x5F ...  95
  873. SCAN_CTRL_F3............... 0x60 ...  96
  874. SCAN_CTRL_F4............... 0x61 ...  97
  875. SCAN_CTRL_F5............... 0x62 ...  98
  876. SCAN_CTRL_F6............... 0x63 ...  99
  877. SCAN_CTRL_F7............... 0x64 ... 100
  878. SCAN_CTRL_F8............... 0x65 ... 101
  879. SCAN_CTRL_F9............... 0x66 ... 102
  880. SCAN_CTRL_F10.............. 0x67 ... 103
  881. SCAN_ALT_F1................ 0x68 ... 104
  882. SCAN_ALT_F2................ 0x69 ... 105
  883. SCAN_ALT_F3................ 0x6A ... 106
  884. SCAN_ALT_F4................ 0x6B ... 107
  885. SCAN_ALT_F5................ 0x6C ... 108
  886. SCAN_ALT_F6................ 0x6D ... 109
  887. SCAN_ALT_F7................ 0x6E ... 110
  888. SCAN_ALT_F8................ 0x6F ... 111
  889. SCAN_ALT_F9................ 0x70 ... 112
  890. SCAN_ALT_F10............... 0x71 ... 113
  891. SCAN_CTRL_PRTSC............ 0x72 ... 114
  892. SCAN_CTRL_LEFT............. 0x73 ... 115
  893. SCAN_CTRL_RIGHT............ 0x74 ... 116
  894. SCAN_CTRL_END.............. 0x75 ... 117
  895. SCAN_CTRL_PGDN............. 0x76 ... 118
  896. SCAN_CTRL_HOME............. 0x77 ... 119
  897. SCAN_ALT_1................. 0x78 ... 120
  898. SCAN_ALT_2................. 0x79 ... 121
  899. SCAN_ALT_3................. 0x7A ... 122
  900. SCAN_ALT_4................. 0x7B ... 123
  901. SCAN_ALT_5................. 0x7C ... 124
  902. SCAN_ALT_6................. 0x7D ... 125
  903. SCAN_ALT_7................. 0x7E ... 126
  904. SCAN_ALT_8................. 0x7F ... 127
  905. SCAN_ALT_9................. 0x80 ... 128
  906. SCAN_ALT_0................. 0x81 ... 129
  907. SCAN_ALT_HYPHEN............ 0x82 ... 130
  908. SCAN_ALT_EQUAL............. 0x83 ... 131
  909. SCAN_CTRL_PGUP............. 0x84 ... 132
  910. SCAN_F11................... 0x85 ... 133
  911. SCAN_F12................... 0x86 ... 134
  912. SCAN_SHIFT_F11............. 0x87 ... 135
  913. SCAN_SHIFT_F12............. 0x88 ... 136
  914. SCAN_CTRL_F11.............. 0x89 ... 137
  915. SCAN_CTRL_F12.............. 0x8A ... 138
  916. SCAN_ALT_F11............... 0x8B ... 139
  917. SCAN_ALT_F12............... 0x8C ... 140
  918. SCAN_CTRL_UP............... 0x8D ... 141
  919. SCAN_CTRL_KEYPAD_MINUS..... 0x8E ... 142
  920. SCAN_CTRL_KEYPAD_5......... 0x8F ... 143
  921. SCAN_CTRL_KEYPAD_PLUS...... 0x90 ... 144
  922. SCAN_CTRL_DOWN............. 0x91 ... 145
  923. SCAN_CTRL_INS.............. 0x92 ... 146
  924. SCAN_CTRL_DEL.............. 0x93 ... 147
  925. SCAN_CTRL_TAB.............. 0x94 ... 148
  926. SCAN_CTRL_KEYPAD_SLASH..... 0x95 ... 149
  927. SCAN_CTRL_KEYPAD_ASTERISK.. 0x96 ... 150
  928. SCAN_ALT_HOME.............. 0x97 ... 151
  929. SCAN_ALT_UP................ 0x98 ... 152
  930. SCAN_ALT_PGUP.............. 0x99 ... 153
  931. SCAN_ALT_LEFT.............. 0x9B ... 155
  932. SCAN_ALT_RIGHT............. 0x9D ... 157
  933. SCAN_ALT_END............... 0x9F ... 159
  934. SCAN_ALT_DOWN.............. 0xA0 ... 160
  935. SCAN_ALT_PGDN.............. 0xA1 ... 161
  936. SCAN_ALT_INS............... 0xA2 ... 162
  937. SCAN_ALT_DEL............... 0xA3 ... 163
  938. SCAN_ALT_SLASH............. 0xA4 ... 164
  939. SCAN_ALT_TAB............... 0xA5 ... 165
  940. SCAN_ALT_ENTER............. 0xA6 ... 166
  941. SCAN_CTRL_ENTER............ 0xE0 ... 224
  942.  
  943. --------------------------------------------------------------------------------
  944.  
  945. /* ASCII GRAPHIC DEFINITIONS */
  946.  
  947. HOUSE1L.... 0 ... house #1[left]
  948. HOUSE1R.... 1 ... house #1[right]
  949. TREE1...... 2 ... tree #1
  950. CAR1L...... 3 ... car #1[left]
  951. CAR1R...... 4 ... car #2[right]
  952. DINO1L..... 5 ... dinosaur #1[left]
  953. DINO1R..... 6 ... dinosaur #1[right]
  954. SHIP1N..... 7 ... ship #1[N]
  955. SHIP1NE.... 8 ... ship #1[NE]
  956. SHIP1E..... 9 ... ship #1[E]
  957. SHIP1SE... 10 ... ship #1[SE]
  958. SHIP1S.... 11 ... ship #1[S]
  959. SHIP1SW... 12 ... ship #1[SW]
  960. SHIP1W.... 13 ... ship #1[W]
  961. SHIP1NW... 14 ... ship #1[NW]
  962. BIRD1..... 15 ... bird #1
  963. DIAMON1... 16 ... diamond #1
  964. EXPLOS1... 17 ... explosion #1
  965. TOOTHG1... 18 ... toothgrin #1
  966. HOURGL1... 19 ... hourglass #1
  967. METEOR1... 20 ... meteor #1
  968. SPACES1... 21 ... spaceship #1
  969. BIKERL1... 22 ... biker #1[left]
  970. BIKERR1... 23 ... biker #1[right]
  971. FROWN1.... 24 ... frown #1
  972. GRIN1..... 25 ... grin #1
  973. LAMP1L.... 26 ... lamp #1[left]
  974. LAMP1R.... 27 ... lamp #1[right]
  975. SAILB1L... 28 ... sailboat #1[left]
  976. SAILB1R... 29 ... sailboat #1[right]
  977. SHARK1L... 30 ... shark #1[left]
  978. SHARK1R... 31 ... shark #1[right]
  979. TARGET1... 32 ... target #1
  980. TRUCK1L... 33 ... truck #1[left]
  981. TRUCK1R... 34 ... truck #1[right]
  982. VAN1L..... 35 ... van #1[left]
  983. VAN1R..... 36 ... van #1[right]
  984. BALLO11... 37 ... balloon #1[1]
  985. BALLO12... 38 ... balloon #1[2]
  986. BALLO13... 39 ... balloon #1[3]
  987. SUN1...... 40 ... sun #1
  988. FIGUR3L... 41 ... figure #3[left]
  989. FIGUR3R... 42 ... figure #3[right]
  990. FIGUR41... 43 ... figure #4[1]
  991. FIGUR42... 44 ... figure #4[2]
  992. FIGUR52... 45 ... figure #5[2]
  993. FISH1L.... 46 ... fish #1[left]
  994. FISH1R.... 47 ... fish #1[right]
  995. FISH2L.... 48 ... fish #2[left]
  996. FISH2R.... 49 ... fish #2[right]
  997. PLANE1L... 50 ... plane #1[left]
  998. PLANE1R... 51 ... plane #1[right]
  999. JET1L..... 52 ... jet #1[left]
  1000. JET1R..... 53 ... jet #1[right]
  1001. TARGET2... 54 ... target #2
  1002. BOTTLE1... 55 ... bottle #1
  1003. FIGUR1L... 56 ... figure #1[left]
  1004. FIGUR1R... 57 ... figure #1[right]
  1005. FIGUR2L... 58 ... figure #2[left]
  1006. FIGUR2R... 59 ... figure #2[right]
  1007. FIGUR51... 60 ... figure #5[1]
  1008. FIGUR6L... 61 ... figure #6[left]
  1009. FIGUR6R... 62 ... figure #6[right]
  1010. MOON1L.... 63 ... moon #1[left]
  1011. MOON1R.... 64 ... moon #1[right]
  1012.  
  1013. byte codes[] = {
  1014.   (word)HOUSE1L, 192,126,                             /* house #1[left]     */
  1015.   (word)HOUSE1R, 193,127,                             /* house #1[right]    */
  1016.   (word)TREE1  , 194,145,                             /* tree #1            */
  1017.   (word)CAR1L  , 195,146,                             /* car #1[left]       */
  1018.   (word)CAR1R  , 196,164,                             /* car #2[right]      */
  1019.   (word)DINO1L , 197,165,                             /* dinosaur #1[left]  */
  1020.   (word)DINO1R , 198,166,                             /* dinosaur #1[right] */
  1021.   (word)SHIP1N , 199,167,                             /* ship #1[N]         */
  1022.   (word)SHIP1NE, 200,168,                             /* ship #1[NE]        */
  1023.   (word)SHIP1E , 201,169,                             /* ship #1[E]         */
  1024.   (word)SHIP1SE, 202,170,                             /* ship #1[SE]        */
  1025.   (word)SHIP1S , 203,171,                             /* ship #1[S]         */
  1026.   (word)SHIP1SW, 204,172,                             /* ship #1[SW]        */
  1027.   (word)SHIP1W , 205,173,                             /* ship #1[W]         */
  1028.   (word)SHIP1NW, 206,174,                             /* ship #1[NW]        */
  1029.   (word)BIRD1  , 207,175,                             /* bird #1            */
  1030.   (word)DIAMON1, 208,179,                             /* diamond #1         */
  1031.   (word)EXPLOS1, 209,180,                             /* explosion #1       */
  1032.   (word)TOOTHG1, 210,181,                             /* toothgrin #1       */
  1033.   (word)HOURGL1, 211,182,                             /* hourglass #1       */
  1034.   (word)METEOR1, 212,183,                             /* meteor #1          */
  1035.   (word)SPACES1, 213,184,                             /* spaceship #1       */
  1036.   (word)BIKERL1, 214,185,                             /* biker #1[left]     */
  1037.   (word)BIKERR1, 215,186,                             /* biker #1[right]    */
  1038.   (word)FROWN1 , 216,187,                             /* frown #1           */
  1039.   (word)GRIN1  , 217,188,                             /* grin #1            */
  1040.   (word)LAMP1L , 218,189,                             /* lamp #1[left]      */
  1041.   (word)LAMP1R , 219,190,                             /* lamp #1[right]     */
  1042.   (word)SAILB1L, 220,191,                             /* sailboat #1[left]  */
  1043.   (word)SAILB1R, 221,224,                             /* sailboat #1[right] */
  1044.   (word)SHARK1L, 222,225,                             /* shark #1[left]     */
  1045.   (word)SHARK1R, 223,226,                             /* shark #1[right]    */
  1046.   (word)
  1047.   (word)TARGET1, 192,126,                             /* target #1          */
  1048.   (word)TRUCK1L, 193,127,                             /* truck #1[left]     */
  1049.   (word)TRUCK1R, 194,145,                             /* truck #1[right]    */
  1050.   (word)VAN1L  , 195,146,                             /* van #1[left]       */
  1051.   (word)VAN1R  , 196,164,                             /* van #1[right]      */
  1052.   (word)BALLO11, 197,165,                             /* balloon #1[1]      */
  1053.   (word)BALLO12, 198,166,                             /* balloon #1[2]      */
  1054.   (word)BALLO13, 199,167,                             /* balloon #1[3]      */
  1055.   (word)SUN1   , 200,168,                             /* sun #1             */
  1056.   (word)FIGUR3L, 201,169,                             /* figure #3[left]    */
  1057.   (word)FIGUR3R, 202,170,                             /* figure #3[right]   */
  1058.   (word)FIGUR41, 203,171,                             /* figure #4[1]       */
  1059.   (word)FIGUR42, 204,172,                             /* figure #4[2]       */
  1060.   (word)FIGUR52, 205,173,                             /* figure #5[2]       */
  1061.   (word)FISH1L , 206,174,                             /* fish #1[left]      */
  1062.   (word)FISH1R , 207,175,                             /* fish #1[right]     */
  1063.   (word)FISH2L , 208,179,                             /* fish #2[left]      */
  1064.   (word)FISH2R , 209,180,                             /* fish #2[right]     */
  1065.   (word)PLANE1L, 210,181,                             /* plane #1[left]     */
  1066.   (word)PLANE1R, 211,182,                             /* plane #1[right]    */
  1067.   (word)JET1L  , 212,183,                             /* jet #1[left]       */
  1068.   (word)JET1R  , 213,184,                             /* jet #1[right]      */
  1069.  
  1070.   (word)TARGET2, 255,                                 /* target #2          */
  1071.   (word)BOTTLE1, 254,                                 /* bottle #1          */
  1072.   (word)FIGUR1L, 253,                                 /* figure #1[left]    */
  1073.   (word)FIGUR1R, 252,                                 /* figure #1[right]   */
  1074.   (word)FIGUR2L, 251,                                 /* figure #2[left]    */
  1075.   (word)FIGUR2R, 250,                                 /* figure #2[right]   */
  1076.   (word)FIGUR51, 249,                                 /* figure #5[1]       */
  1077.   (word)FIGUR6L, 248,                                 /* figure #6[left]    */
  1078.   (word)FIGUR6R, 247,                                 /* figure #6[right]   */
  1079.   (word)MOON1L , 246,                                 /* moon #1[left]      */
  1080.   (word)MOON1R , 245                                  /* moon #1[right]     */
  1081. };
  1082.  
  1083. --------------------------------------------------------------------------------
  1084.  
  1085. /* MESSAGES */
  1086.  
  1087. DASHES printf("\n----------------------------------------
  1088.                  ----------------------------------------")
  1089. DISTRIBUTE printf("\n-------------------------  DISTRIBUTION IS ENCOURAGED  ----
  1090.                      ---------------------")
  1091. DOUBLESPACE printf("\n\n")
  1092. SINGLESPACE printf("\n")
  1093.  
  1094. --------------------------------------------------------------------------------
  1095.  
  1096. /* MACROS */
  1097.  
  1098. ischar(ch) (((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
  1099.            || ch == APOSTROPHE || ch == HYPHEN) ? TRUE : FALSE)
  1100.   RETURNS:  TRUE if 'ch' is a valid character used in words
  1101.            FALSE if 'ch' is not a valid character used in words
  1102.  
  1103.  
  1104. /* ONE-ARGUMENT MACROS */
  1105.  
  1106.   absolute value of a
  1107. ABS(a)     (((a)<0) ? -(a) : (a))
  1108.  
  1109.   round a to nearest integer towards 0
  1110. FLOOR(a)   ((a)>0 ? (int)(a) : -(int)(-a))
  1111.  
  1112.   round a to nearest integer away from 0
  1113. CEILING(a) ( (a) == (int)(a) ? (a) \
  1114.                    : (a) > 0 ? 1+(int)(a) : -( 1+(int)(-a) ))
  1115.  
  1116.   round a to nearest int
  1117. ROUND(a)   (((a) > 0) ? (int)(a+0.5) : -(int)(0.5-a))
  1118.  
  1119.   take sign of a, either -1, 0, or 1
  1120. ZSGN(a)    (((a) < 0) ? -1 : (a) > 0 ? 1 : 0)
  1121.  
  1122.   take binary sign of a, either -1, or 1 if >= 0
  1123. SGN(a)     (((a) < 0) ? -1 : 1)
  1124.  
  1125.   shout if something that should be true isn't
  1126. ASSERT(x)  if (!(x)) fprintf(stderr," Assert failed: x\n");
  1127.  
  1128.   square a
  1129. SQR(a)     ((a)*(a))
  1130.  
  1131.  
  1132. /* TWO-ARGUMENT MACROS */
  1133.  
  1134.   return minimum of a and b
  1135. MINIMUM(a,b)    ( ((a) < (b)) ? (a) : (b) )
  1136.  
  1137.   return maximum of a and b
  1138. MAXIMUM(a,b)    ( ((a) > (b)) ? (a) : (b) )
  1139.  
  1140.   swap a and b
  1141. SWAP(a,b)       { a^=b; b^=a; a^=b; }
  1142.  
  1143.   linear interpolation from l (when a=0) to h (when a=1)
  1144.   (equal to (a*h) + ( (1-a) * l)
  1145. LERP(a,l,h)     ( (l) + (((h)-(l)) * (a)) )
  1146.  
  1147.   clamp the input to the specified range
  1148. CLAMP(v,l,h)    ( (v) < (l) ? (l) : (v) > (h) ? (h) : v)
  1149.  
  1150.  
  1151. /* MEMORY ALLOCATION MACROS */
  1152.  
  1153.   create a new instance of a structure (see Gem by Hultquist)
  1154. NEWSTRUCT(x) (struct x *) (malloc( (unsigned)sizeof(struct x) ))
  1155.  
  1156.   create a new instance of a type
  1157. NEWTYPE(x) (x *) (malloc( (unsigned)sizeof(x) ))
  1158.  
  1159. --------------------------------------------------------------------------------
  1160.  
  1161. /* TYPE DEFINITIONS */
  1162.  
  1163. typedef unsigned char boolean... a TRUE or FALSE type, as in Pascal
  1164. typedef boolean flag............ flag data type
  1165. typedef unsigned char byte...... an 8-bit/1 byte (0..255)     type, as in Pascal
  1166. typedef signed char shortint.... an 8-bit/1 byte (-128..+127) type, as in Pascal
  1167. typedef unsigned int word....... a 16-bit/2-byte (0..65535)   type, as in Pascal
  1168.  
  1169. typedef struct {
  1170.    byte ascii................... ASCII code of character pressed
  1171.    byte scan.................... SCAN code of character pressed
  1172. } asciiscan;
  1173.  
  1174. typedef struct {
  1175.    byte y....................... ordinate
  1176.    byte x....................... abscissa
  1177.    byte start................... starting scan line
  1178.    byte end..................... ending scan line
  1179.    boolean on................... TRUE if the cursor is on, FALSE if it is not
  1180. } cursordata;
  1181.  
  1182. typedef struct document_def {
  1183.   char  *line................... pointer to a line of the document
  1184.   struct document_def *prev..... pointer to previous line
  1185.   struct document_def *next..... pointer to next line
  1186. } document;
  1187.  
  1188. typedef struct {
  1189.    byte fgclr................. foreground color or NO if no color fill
  1190.    byte bgclr................. background color or NO if no color fill
  1191.    char fillchar.............. character to fill with or NO if no character fill
  1192.    byte x..................... abscissa (if TCUR, uses text cursor abscissa
  1193.                                          if MCUR, uses mouse cursor abscissa)
  1194.    byte y..................... ordinate (if TCUR, uses text cursor ordinate
  1195.                                          if MCUR, uses mouse cursor ordinate)
  1196.    shortint length............ x-length of area
  1197.    shortint height............ y-height of area
  1198.    char *overwrite............ text to overwrite or NULL if overwrite all
  1199.    char *text................. text to print or NULL if no text
  1200. } filldata;
  1201. *** NOTE  if "fillchar" and "print" are both defined, "print" is printed
  1202.  
  1203. typedef struct {
  1204.    word size............... size of image in bytes
  1205.    byte tclr............... transparency color or number of 8-pixel groups
  1206.    int x................... abscissa (if MCUR, uses mouse cursor abscissa)
  1207.    int y................... ordinate (if MCUR, uses mouse cursor ordinate)
  1208.    int length.............. x-length (do not modify)
  1209.    int height.............. y-height (do not modify)
  1210.    int how : 1............. draw with the current scroll (TRUE) or not (FALSE)
  1211.    int for_future : 15..... no current purpose, other than to fill the integer
  1212. } imagedata;
  1213. *** NOTE  if used with _16_i_... "tclr" is number of 8-pixel groups per row
  1214.           if used with _16_c_... or _16_p_..., "tclr" is transparency color
  1215.  
  1216. typedef struct linked_list {
  1217.   struct linked_list *next...... pointer to next node
  1218. } llist;
  1219.  
  1220. typedef struct linked_list_s {
  1221.   struct linked_list_s *next.... pointer to next node
  1222. } llist_single;
  1223.  
  1224. typedef struct linked_list_d {
  1225.   struct linked_list_d *prev.... pointer to previous node
  1226.   struct linked_list_d *next.... pointer to next node
  1227. } llist_double;
  1228.  
  1229. typedef struct {
  1230.    byte update.............  TRUE "ms_stat" has updated structure "mousedata"
  1231.                 FALSE no structure variables have been updated
  1232.    int pos[2].............. old mouse cursor x,y position
  1233.    int buts[2]............. old left,right button  0 not pressed  1 pressed
  1234.    int npos[2]............. new mouse cursor x,y position
  1235.    int nbuts[2]............ new left,right button  0 not pressed  1 pressed
  1236.    int butlr[2]............ x,y position of last left button release
  1237.    int butlp[2]............ x,y position of last left button press
  1238.    int butrr[2]............ x,y position of last right button release
  1239.    int butrp[2]............ x,y position of last right button press
  1240. } mousedata;
  1241.  
  1242. typedef struct {
  1243.    byte fgclr.............. foreground color or NO if no color fill
  1244.    byte bgclr.............. background color or NO if no color fill
  1245.    byte command = ALIGN_NONE   - no command
  1246.                 = ALIGN_HORZ   - horizontal center; shifts odd lengths left
  1247.                 = ALIGN_VERT   - vertical center; shifts odd lengths up
  1248.                 = ALIGN_CENTER - horizontal and vertical center
  1249.                 = ALIGN_RIGHT  - right justify; flush to the right margin
  1250.    byte x.................. abscissa (if TCUR, uses text cursor abscissa
  1251.                                       if MCUR, uses mouse cursor abscissa)
  1252.    byte y.................. ordinate (if TCUR, uses text cursor ordinate
  1253.                                       if MCUR, uses mouse cursor ordinate)
  1254.    char *text.............. text to print
  1255. } printdata;
  1256. *** NOTE  "command" will revert to ALIGN_NONE if the length of string "string"
  1257.       is greater than 80 (the width of the text screen)
  1258. *** NOTE  if both "x" and "y" = TCUR, the cursor is advanced to one past the
  1259.           last character printed
  1260.  
  1261. typedef struct {
  1262.    word size............... size of image in bytes
  1263.    byte fgclr.............. NO if no color fill
  1264.    byte bgclr.............. NO if no color fill
  1265.    byte x.................. abscissa (if TCUR, uses text cursor abscissa
  1266.                                       if MCUR, uses mouse cursor abscissa)
  1267.    byte y.................. ordinate (if TCUR, uses text cursor ordinate
  1268.                                       if MCUR, uses mouse cursor ordinate)
  1269.    byte length............. x-length (do not modify)
  1270.    byte height............. y-height (do not modify)
  1271. } textimagedata;
  1272.  
  1273. typedef struct {
  1274.    byte fgclr.............. foreground color or NO if no color fill
  1275.    byte bgclr.............. background color or NO if no color fill
  1276.    byte x.................. abscissa (if TCUR, uses text cursor abscissa
  1277.                                       if MCUR, uses mouse cursor abscissa)
  1278.    byte y.................. ordinate (if TCUR, uses text cursor ordinate
  1279.                                       if MCUR, uses mouse cursor ordinate)
  1280. } textstr;
  1281.  
  1282. typedef struct {
  1283.   byte fgclr, bgclr................. color of text inside window
  1284.        x, y......................... top,left coordinates of window
  1285.        length, height............... length and height of window
  1286.        parts........................ window parts to use
  1287.        shadow_style................. shadow style
  1288.        border_fgclr, border_bgclr... color of border
  1289.        shadow_fgclr, shadow_bgclr... color of shadow
  1290.        title_fgclr, title_bgclr..... color of title
  1291.   char *border...................... border characters
  1292.        *shadow...................... shadow characters
  1293.        *title....................... window title
  1294.   document *text.................... pointer to text of window
  1295. } window_data;
  1296.  
  1297.  
  1298. /* 2-D GEOMETRY TYPES */
  1299.  
  1300. typedef struct point2_struct {         /* 2d point         */
  1301.   double x, y;
  1302. } point2;
  1303.  
  1304. typedef point2 vector2;
  1305.  
  1306. typedef struct point2_int_struct {     /* 2d integer point */
  1307.   int x, y;
  1308. } point2_int;
  1309.  
  1310. typedef struct matrix3_struct {        /* 3-by-3 matrix    */
  1311.   double element[3][3];
  1312. } matrix3;
  1313.  
  1314. typedef struct box2d_struct {          /* 2d box           */
  1315.   point2 min, max;
  1316. } box2;
  1317.  
  1318.  
  1319. /* 3-D GEOMETRY TYPES */
  1320.  
  1321. typedef struct point3_struct {         /* 3d point         */
  1322.   double x, y, z;
  1323. } point3;
  1324.  
  1325. typedef point3 vector3;
  1326.  
  1327. typedef struct point3_int_struct {     /* 3d integer point */
  1328.   int x, y, z;
  1329. } point3_int;
  1330.  
  1331. typedef struct matrix4_struct {        /* 4-by-4 matrix    */
  1332.   double element[4][4];
  1333. } matrix4;
  1334.  
  1335. typedef struct box3d_struct {          /* 3d box           */
  1336.   point3 min, max;
  1337. } box3;
  1338.  
  1339. --------------------------------------------------------------------------------
  1340.  
  1341. /* GLOBAL VARIABLE DEFINITIONS */
  1342.  
  1343. volatile external boolean blink                                 default is TRUE
  1344.        blink = TRUE  if blinking characters and 8 background colors
  1345.   else blink = FALSE if no blinking characters and 16 background colors
  1346.  
  1347. volatile extern boolean mousepresent                            default is FALSE
  1348.        mousepresent = TRUE if mouse is detected by function "ms_init"
  1349.   else mousepresent = FALSE if mouse is not found by function "ms_init"
  1350.  
  1351. volatile extern word chr_output                                 default is MAX
  1352.   chr_output = maximum number of characters to print with any output subfunction
  1353.                (useful for windowing text)
  1354.              = MAX for no limit on the number of characters to print
  1355.  
  1356. volatile external boolean txt_cur_move                          default is TRUE
  1357.        txt_cur_move = TRUE  if text cursor will move if x = y = TCUR
  1358.   else txt_cur_move = FALSE if text cursor will not move if x = y = TCUR
  1359.  
  1360. volatile extern word txt_length                                 default is 80
  1361.   character width of virtual text screen (used when smooth scrolling)
  1362.  
  1363. ================================================================================
  1364.  
  1365.  
  1366. =================================------------===================================
  1367. -----------------------------------  FILE  -------------------------------------
  1368.                                  ------------
  1369. FILE *fil_count(char *filename,
  1370.                 char *title, char *author, char *msgs[], word msg_num);
  1371. Function: Report the number of program executions, print a random comment, and
  1372.           and print the amount of memory available.
  1373.  
  1374. FILE *fil_count_reg(char *filename, char *title, char *author, char *registree);
  1375. Function: Report the number of program executions, print to whom the program
  1376.           is registered to, and print the amount of memory available.
  1377.  
  1378. Arguments: = opens the data file "filename" and increment the number of program
  1379.              executions
  1380.            = the program title "title" and the author name "author" is used in
  1381.              all messages referencing this information
  1382.            = fil_count - one of "msg_num" messages stored in "msgs" will be
  1383.                          printed (chosen randomly)
  1384.            = fil_count_reg - prints to whom the program is registered to
  1385.  
  1386. Notes: The file pointer is set to just after the first integer (the program
  1387.        execution counter).  NOTE #include <alloc.h> must be present in the
  1388.        module that calls this function or the reported amount of available
  1389.        memory will be inaccurate.  If a file error occurs, an exit to DOS, with
  1390.        the appropriate message and ERRORLEVEL=1, will follow.
  1391.  
  1392. Return Value: = file handle of data file
  1393.  
  1394. --------------------------------------------------------------------------------
  1395.                                                                             FILE
  1396. long fil_len(FILE *f);
  1397. Function: Return the length of a file, in bytes.
  1398.  
  1399. Arguments: = "f" - file handle of file to return to length of
  1400.  
  1401. Notes: The current position of the file is not modified.
  1402.  
  1403. Return Value: = length of file, in bytes
  1404.  
  1405. --------------------------------------------------------------------------------
  1406.                                                                             FILE
  1407. char *fil_next_str(word *size, FILE *f);
  1408. Function: Return the next string from the current file position.
  1409.  
  1410. char *fil_next_word(word *size, FILE *f);
  1411. Function: Return the next word from the current file position.
  1412.  
  1413. Arguments: = "size" - initial size of input buffer
  1414.            = "f"    - file handle to read from
  1415.  
  1416. Notes: A string can consist of alphanumeric characters, hyphens, apostrophes, or
  1417.        text surrounded in quotes, like "It is: 04/12/94" -- nothing else.  A
  1418.        word can consist of only alphabet letters.  If the input buffer ever
  1419.        becomes full, it is increased by "size" bytes.  "size" is modified to the
  1420.        new size.
  1421.  
  1422. Return Value: = pointer to word read in (file pointer is set to the byte just
  1423.                 after the word)
  1424.               = NULL if no word was found (file pointer is set to EOF)
  1425.  
  1426. See Also: fil_read_to
  1427.  
  1428. --------------------------------------------------------------------------------
  1429.                                                                             FILE
  1430. char *fil_read_to(char *str, word *size, FILE *f);
  1431. Function: Return from the current file position upto the first occurrence of a
  1432.           string.
  1433.  
  1434. char *fil_read_to_strip(char *str, word *size, FILE *f);
  1435. Function: Return from the current file position upto the first occurrence of a
  1436.           string, stripping all comments (beginning with a ';'), blank lines,
  1437.           and extra spaces, and strip all spaces surrounding '=' (equal signs).
  1438.  
  1439. Arguments: = "str"  - string to read up to
  1440.            = "size" - initial size of input buffer
  1441.            = "f"    - file handle to read from
  1442.  
  1443. Notes: If the input buffer ever becomes full, it is increased by "size" bytes.
  1444.        "size" is modified to the new size.
  1445.        For "fil_read_to_strip", an example of what is stripped:
  1446.  
  1447.   This   is  "not; [I] =  say"      ;he said
  1448. [not  ["  I"] say]
  1449.  
  1450.  to  = this.
  1451.  
  1452.        becomes:
  1453.  
  1454. This is "not; [I] =  say"
  1455. [not  ["  I"] say]
  1456. to=this.
  1457.  
  1458.        - Text inside quotation marks (ie. string) is unaltered ('[' ']' are also
  1459.          considered to be quotation marks)
  1460.          - note that these may be nested, and the actual quotation marks are
  1461.            considered to be the outside ones
  1462.  
  1463. Return Value: = pointer to contents of file read in (file pointer is set to the
  1464.                 byte just after the match)
  1465.               = NULL if no match was found (file pointer is set to EOF)
  1466.  
  1467. See Also: fil_next_word fil_skip_to
  1468.  
  1469. --------------------------------------------------------------------------------
  1470.                                                                             FILE
  1471. word fil_skip_past(char *str, FILE *f);
  1472. Function: Search from the current file position for the first occurrence of a
  1473.           string, and set the file pointer to just past it.
  1474.  
  1475. Arguments: = "str" - string to skip past
  1476.            = "f"   - file handle to read from
  1477.  
  1478. Return Value: = number of bytes acanned upto (and including) last byte of match
  1479.                 (file pointer is set to byte just after match)
  1480.               = FALSE if no match was found (file pointer is set to EOF)
  1481.  
  1482. See Also: fil_skip_to
  1483.  
  1484. --------------------------------------------------------------------------------
  1485.                                                                             FILE
  1486. word fil_skip_to(char *str, FILE *f);
  1487. Function: Search from the current file position for the first occurrence of a
  1488.           string, and set the file pointer to the beginning of it.
  1489.  
  1490. Arguments: = "str" - string to skip to
  1491.            = "f"   - file handle to read from
  1492.  
  1493. Return Value: = number of bytes acanned upto (and including) first byte of match
  1494.                 (file pointer is set to first byte of match)
  1495.               = FALSE if no match was found (file pointer is set to EOF)
  1496.  
  1497. See Also: fil_read_to fil_skip_past
  1498.  
  1499. ================================================================================
  1500. ---------------------------------  INI FILE  -----------------------------------
  1501.  
  1502. boolean ini_get_boolean(char *section, char *section_title, char *option);
  1503. Function: Translate the boolean word "TRUE" or "FALSE" into the boolean
  1504.           numerical value TRUE or FALSE, respectively.
  1505.  
  1506. Arguments: = from .INI file section "section", specifically under the section
  1507.          entitled "section_title", the boolean from option "option" is read
  1508.  
  1509. Notes: Only "TRUE" or "FALSE" are recognized.  See the function
  1510.        "ini_read_section" for an example of a typical .INI file, where section
  1511.        titles, options, and parameters are explained.
  1512.  
  1513. Return Value: = FALSE if found string "FALSE"
  1514.               = TRUE  if found string "TRUE"
  1515.  
  1516. See Also: ini_get_color ini_get_number
  1517.  
  1518. --------------------------------------------------------------------------------
  1519.                                                                         INI FILE
  1520. byte ini_get_color(char *section, char *section_title, char *option);
  1521. Function: Translate a color name into its numerical equivalent.
  1522.  
  1523. Arguments: = from .INI file section "section", specifically under the section
  1524.          entitled "section_title", the color from option "option" is read
  1525.  
  1526. Notes: Only "BLACK", "BLUE", "GREEN", "CYAN", "RED", "MAGENTA", "BROWN",
  1527.        "LIGHTGREY", "DARKGREY", "LIGHTBLUE", "LIGHTGREEN", "LIGHTCYAN",
  1528.        "LIGHTRED", "LIGHTMAGENTA", "YELLOW", and "WHITE" are recognized.  See
  1529.        the function "ini_read_section" for an example of a typical .INI file,
  1530.        where section titles, options, and parameters are explained.
  1531.  
  1532. Return Value: = numerical equivalent of color name
  1533.  
  1534. See Also: ini_get_boolean
  1535.  
  1536. --------------------------------------------------------------------------------
  1537.                                                                         INI FILE
  1538. int ini_get_number(char *section, char *section_title, char *option);
  1539. Function: Translate an ASCII representation of a number into its numerical
  1540.       representation.
  1541.  
  1542. Arguments: = from .INI file section "section", specifically under the section
  1543.          entitled "section_title", the number from option "option" is read
  1544.  
  1545. Notes: Only decimal number strings are recognized.  See the function
  1546.        "ini_read_section" for an example of a typical .INI file, where section
  1547.        titles, options, and parameters are explained.
  1548.  
  1549. Return Value: = numerical representation of number string
  1550.  
  1551. See Also: ini_get_boolean ini_get_position ini_get_rows
  1552.  
  1553. --------------------------------------------------------------------------------
  1554.                                                                         INI FILE
  1555. int ini_get_position(char *section, char *section_title, char *option);
  1556. Function: Translate the screen position "TOP" or "BOTTOM" into its row number
  1557.       equivalent.
  1558.  
  1559. Arguments: = from .INI file section "section", specifically under the section
  1560.          entitled "section_title", the screen position from option "option"
  1561.          is read
  1562.  
  1563. Notes: Only "TOP" or "BOTTOM" are recognized.  See the function
  1564.        "ini_read_section" for an example of a typical .INI file, where section
  1565.        titles, options, and parameters are explained.
  1566.  
  1567. Return Value: = screen row number
  1568.  
  1569. See Also: ini_get_number
  1570.  
  1571. --------------------------------------------------------------------------------
  1572.                                                                         INI FILE
  1573. int ini_get_rows(char *section, char *section_title, char *option);
  1574. Function: Translate the number of rows per screen "25", "50", or "UNMODIFY" into
  1575.       its numerical equivalent.
  1576.  
  1577. Arguments: = from .INI file section "section", specifically under the section
  1578.          entitled "section_title", the number of rows per screen from option
  1579.          "option" is read
  1580.  
  1581. Notes: Only "25", "50", or "UNMODIFY" are recognized.  See the function
  1582.        "ini_read_section" for an example of a typical .INI file, where section
  1583.        titles, options, and parameters are explained.
  1584.  
  1585. Return Value: = 25                  if found string "25"
  1586.           = 50                  if found string "50"
  1587.           = current number of rows per screen if found string "UNMODIFY"
  1588.  
  1589. See Also: ini_get_position ini_get_state
  1590.  
  1591. --------------------------------------------------------------------------------
  1592.                                                                         INI FILE
  1593. int ini_get_state(char *section, char *section_title, char *option);
  1594. Function: Translate the keyboard state "ON", "OFF", or "UNMODIFY" into a
  1595.           numerical equivalent.
  1596.  
  1597. Arguments: = from .INI file section "section", specifically under the section
  1598.              entitled "section_title", the keyboard state from option "option"
  1599.              is read
  1600.  
  1601. Notes: Only "ON", "OFF", or "UNMODIFY" are recognized.  See the function
  1602.        "ini_read_section" for an example of a typical .INI file, where section
  1603.        titles, options, and parameters are explained.
  1604.  
  1605. Return Value: = 0 if found string "ON"
  1606.               = 1 if found string "OFF"
  1607.               = 2 if found string "UNMODIFY"
  1608.  
  1609. See Also: ini_get_rows
  1610.  
  1611. --------------------------------------------------------------------------------
  1612.                                                                         INI FILE
  1613. byte ini_get_state(char *section, char *section_title, char *option);
  1614. Function: Translate the keyboard state "ON", "OFF", or "UNMODIFY" into its
  1615.       numerical equivalent.
  1616.  
  1617. Arguments: = from .INI file section "section", specifically under the section
  1618.          entitled "section_title", the keyboard state from option "option"
  1619.          is read
  1620.  
  1621. Notes: Only "ON", "OFF", or "UNMODIFY" are recognized.  See the function
  1622.        "ini_read_section" for an example of a typical .INI file, where section
  1623.        titles, options, and parameters are explained.
  1624.  
  1625. Return Value: = 0 if found string "OFF"
  1626.           = 1 if found string "ON"
  1627.           = 2 if found string "UNMODIFY"
  1628.  
  1629. See Also: ini_get_position ini_get_yesno
  1630.  
  1631. --------------------------------------------------------------------------------
  1632.                                                                         INI FILE
  1633. char *ini_get_text(char *section, char *section_title, char *option);
  1634. Function: Translate a string surrounded by quotes into a string not surrounded
  1635.           by quotes.
  1636.  
  1637. Arguments: = from .INI file section "section", specifically under the section
  1638.              entitled "section_title", the quote-enclosed string from option
  1639.              "option" is read
  1640.  
  1641. Notes: See the function "ini_read_section" for an example of a typical .INI
  1642.        file, where section titles, options, and parameters are explained.
  1643.  
  1644. Return Value: = string with end-quotes removed
  1645.  
  1646. See Also: ini_get_yesno
  1647.  
  1648. --------------------------------------------------------------------------------
  1649.                                                                         INI FILE
  1650. boolean ini_get_yesno(char *section, char *section_title, char *option);
  1651. Function: Translate the response "YES" or "NO into its numerical equivalent.
  1652.  
  1653. Arguments: = from .INI file section "section", specifically under the section
  1654.              entitled "section_title", the response from option "option" is read
  1655.  
  1656. Notes: Only "YES" or "NO" are recognized.  See the function "ini_read_section"
  1657.        for an example of a typical .INI file, where section titles, options, and
  1658.        parameters are explained.
  1659.  
  1660. Return Value: = TRUE  if found string "YES"
  1661.               = FALSE if found string "NO"
  1662.  
  1663. See Also: ini_get_state ini_get_text
  1664.  
  1665. --------------------------------------------------------------------------------
  1666.                                                                         INI FILE
  1667. char *ini_read_section(char *str1, char *str2, FILE *f);
  1668. Function: Read in the relevant information of a section.
  1669.  
  1670. Arguments: = from .INI file handle "f", the section, beginning with the string
  1671.              "str1" and ending with the string "str2", is read in and returned.
  1672.  
  1673. Notes: The information is read via a call to the function "fil_read_to_strip";
  1674.        see that function's documentation for what is stripped and what is kept.
  1675.  
  1676. Return Value: = relevant section text
  1677.  
  1678. See Also: ini_read_keystore
  1679.  
  1680. EXAMPLE OF A TYPICAL .INI FILE FORMAT
  1681. ------------------------------
  1682.  
  1683. /* this is a comment, and not part of the .INI file */
  1684.  
  1685. ------------------------------
  1686.  
  1687. [EDIT WINDOW] begin
  1688.  
  1689. /* ^----- this is a section beginning, but can also serve as a section title */
  1690.  
  1691.  Rows        = UNMODIFY       ;number of rows per screen page (can be 25 or 50)
  1692.  RightMargin = 80             ;right margin
  1693.  
  1694.             /* ^------ UNMODIFY and 80 are parameters associated with options */
  1695. /* ^----- the above two are options within a section */
  1696.  
  1697. [Initial State]               ;initial keyboard status
  1698.  CAPSLock   = UNMODIFY        ; initial state of the CAPS Lock
  1699.  Insert     = ON              ; initial state of Insert
  1700.  
  1701. [End Of File]                 ;end-of-file message
  1702.  BGColor = BLACK              ; background color
  1703.  FGColor = WHITE              ; foreground color
  1704.  Text = "<≡≡≡ End-Of-File ≡≡≡>" ; text to represent end-of-file
  1705.  
  1706. [EDIT WINDOW] end
  1707.  
  1708. ------------------------------
  1709.  
  1710. [MENU] begin
  1711.  
  1712.  Show     = YES               ;always show main menu?
  1713.  Position = TOP               ;position of menu on screen (TOP or BOTTOM)
  1714.  
  1715. [Normal Text]                 ;normal menu text
  1716.  BGColor = BLACK              ; background color
  1717.  FGColor = LIGHTGREY          ; foreground color
  1718.                               ; main menu items
  1719.  Text    = "  ≡    File    Case Control    Line Draw    Miscellaneous    Help  "
  1720.  
  1721. [MENU] end
  1722.  
  1723. ------------------------------
  1724.  
  1725. ================================================================================
  1726.  
  1727.  
  1728. ===============================----------------=================================
  1729. ---------------------------------  KEYBOARD  -----------------------------------
  1730.                                ----------------
  1731. --------------------------------------------------------------------------------
  1732.                                                                         KEYBOARD
  1733. void kbd_all_off(void);
  1734. Function: Disable all of the three LOCKS (CAPS LOCK, NUM LOCK, and SCROLL
  1735.           LOCK) and turns all of these lights off.
  1736.  
  1737. void kbd_all_on(void);
  1738. Function: Enable all of the three LOCKS (CAPS LOCK, NUM LOCK, and SCROLL LOCK)
  1739.       and turns all of these lights on.
  1740.  
  1741. See Also: kbd_is_all_on kbd_caps_off kbd_insert_off kbd_num_off kbd_scroll_off
  1742.  
  1743. --------------------------------------------------------------------------------
  1744.                                                                         KEYBOARD
  1745. void kbd_caps_off(void);
  1746. Function: Disable the CAPS LOCK key and turns off its light.
  1747.  
  1748. void kbd_caps_on(void);
  1749. Function: Enable the CAPS LOCK key and turns on its light.
  1750.  
  1751. See Also: kbd_is_caps_on kbd_all_off kbd_insert_off kbd_num_off kbd_scroll_off
  1752.  
  1753. --------------------------------------------------------------------------------
  1754.                                                                         KEYBOARD
  1755. char kbd_clear(void);
  1756. Function: Clear the keyboard buffer of all keystrokes.
  1757.  
  1758. Notes: The keyboard buffer is completely emptied.  This is used in common DOS
  1759.        functions, such as "Are you sure (Y/N)?" before a "del *.*".  It
  1760.        ensures the user did not accidentally type a key that he did not wish
  1761.        to be "remembered" for the next question.
  1762.  
  1763. Return Value: = ASCII code of the last character that was in the buffer
  1764.  
  1765. See Also: kbd_hit
  1766.  
  1767. --------------------------------------------------------------------------------
  1768.                                                                         KEYBOARD
  1769. void kbd_give(void);
  1770. Function: Give control back to the original keyboard interrupt.
  1771.  
  1772. See Also: kbd_take
  1773.  
  1774. --------------------------------------------------------------------------------
  1775.                                                                         KEYBOARD
  1776. char kbd_hit(void);
  1777. Function: Check the keyboard buffer to see if a key has been pressed.
  1778.  
  1779. Notes: The keypress detected is not removed from the keyboard buffer (ie. a
  1780.        second call to "kbd_hit" would still return TRUE).  To remove the key
  1781.        from the keyboard buffer, call "getchr" or "getchre".
  1782.  
  1783. Return Value: = ASCII value of key, if a key has been pressed
  1784.               = 0 if no key has been pressed
  1785.  
  1786. See Also: getchr kbd_clear
  1787.  
  1788. --------------------------------------------------------------------------------
  1789.                                                                         KEYBOARD
  1790. void kbd_insert_off(void);
  1791. Function: Disable the INSERT key and turns off its light.
  1792.  
  1793. void kbd_insert_on(void);
  1794. Function: Enable the INSERT key and turns on its light.
  1795.  
  1796. See Also: kbd_is_insert_on kbd_all_off kbd_caps_off kbd_num_off kbd_scroll_off
  1797.  
  1798. ---------------------------------------------------------------------------------
  1799.                                                                         KEYBOARD
  1800. boolean kbd_is_all_on(void);
  1801. Function: Report if all of the three LOCKS (CAPS LOCK, NUM LOCK, and
  1802.       SCROLL LOCK) are active.
  1803.  
  1804. Return Value: = TRUE  - all three LOCKS are active
  1805.           = FALSE - all three LOCKS are not active
  1806.  
  1807. See Also: kbd_is_alt kbd_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_num_on kbd_is_scroll_on
  1808.  
  1809. ---------------------------------------------------------------------------------
  1810.                                                                         KEYBOARD
  1811. boolean kbd_is_alt(void);
  1812. Function: Report if either alt is depressed.
  1813.  
  1814. boolean kbd_is_alt_only(void);
  1815. Function: Report if only an alt is depressed (and not a ctrl or a shift).
  1816.  
  1817. boolean kbd_is_alt_left(void);
  1818. Function: Report if the left alt is depressed.
  1819.  
  1820. boolean kbd_is_alt_left_only(void);
  1821. Function: Report if only the left alt is depressed (and not the right alt, a
  1822.           ctrl, or a shift).
  1823.  
  1824. boolean kbd_is_alt_right(void);
  1825. Function: Report if the right alt is depressed.
  1826.  
  1827. boolean kbd_is_alt_right_only(void);
  1828. Function: Report if only the right alt is depressed (and not the left alt, a
  1829.           ctrl, or a shift).
  1830.  
  1831. Return Value: = kbd_is_alt            - TRUE  - an alt is depressed
  1832.                                   - FALSE - an alt is not depressed
  1833.                 kbd_is_alt_only       - TRUE  - only alt is depressed
  1834.                                   - FALSE - alt is not the only mode key
  1835.                                             depressed
  1836.                 kbd_is_alt_left       - TRUE  - left alt is depressed
  1837.                                   - FALSE - left alt is not depressed
  1838.                 kbd_is_alt_left_only  - TRUE  - only left alt is depressed
  1839.                                   - FALSE - left alt is not the only mode key
  1840.                                             depressed
  1841.                 kbd_is_alt_right      - TRUE  - right alt is depressed
  1842.                                   - FALSE - right alt is not depressed
  1843.                 kbd_is_alt_right_only - TRUE  - only right alt is depressed
  1844.                                   - FALSE - right alt is not the only mode key
  1845.                                             depressed
  1846.  
  1847. See Also: kbd_is_all_on kbd_is_ctrl kbd_is_shift
  1848.  
  1849. --------------------------------------------------------------------------------
  1850.                                                                         KEYBOARD
  1851. boolean kbd_is_caps_on(void);
  1852. Function: Report if CAPS LOCK is active.
  1853.  
  1854. Return Value: = TRUE  - CAPS LOCK is active
  1855.           = FALSE - CAPS LOCK is not active
  1856.  
  1857. See Also: kbd_caps_on kbd_is_all_on kbd_is_insert_on kbd_is_num_on kbd_is_scroll_on
  1858.  
  1859. --------------------------------------------------------------------------------
  1860.                                                                         KEYBOARD
  1861. boolean kbd_is_ctrl(void);
  1862. Function: Report if either ctrl is depressed.
  1863.  
  1864. boolean kbd_is_ctrl_only(void);
  1865. Function: Report if only a ctrl is depressed (and not an alt or a shift).
  1866.  
  1867. boolean kbd_is_ctrl_left(void);
  1868. Function: Report if the left ctrl is depressed.
  1869.  
  1870. boolean kbd_is_ctrl_left_only(void);
  1871. Function: Report if only the left ctrl is depressed (and not the right ctrl, a
  1872.           ctrl, or a shift).
  1873.  
  1874. boolean kbd_is_ctrl_right(void);
  1875. Function: Report if the right ctrl is depressed.
  1876.  
  1877. boolean kbd_is_ctrl_right_only(void);
  1878. Function: Report if only the right ctrl is depressed (and not the left ctrl, a
  1879.           ctrl, or a shift).
  1880.  
  1881. Return Value: = kbd_is_ctrl            - TRUE  - a ctrl is depressed
  1882.                                    - FALSE - a ctrl is not depressed
  1883.                 kbd_is_ctrl_only       - TRUE  - only ctrl is depressed
  1884.                                    - FALSE - ctrl is not the only mode key
  1885.                                              depressed
  1886.                 kbd_is_ctrl_left       - TRUE  - left ctrl is depressed
  1887.                                    - FALSE - left ctrl is not depressed
  1888.                 kbd_is_ctrl_left_only  - TRUE  - only left ctrl is depressed
  1889.                                    - FALSE - left ctrl is not the only mode key
  1890.                                              depressed
  1891.                 kbd_is_ctrl_right      - TRUE  - right ctrl is depressed
  1892.                                    - FALSE - right ctrl is not depressed
  1893.                 kbd_is_ctrl_right_only - TRUE  - only right ctrl is depressed
  1894.                                    - FALSE - right ctrl is not the only mode key
  1895.                                              depressed
  1896. See Also: kbd_is_alt kbd_is_shift
  1897.  
  1898. --------------------------------------------------------------------------------
  1899.                                                                         KEYBOARD
  1900. boolean kbd_is_insert_on(void);
  1901. Function: Report if INSERT is active.
  1902.  
  1903. Return Value: = TRUE  - INSERT is active
  1904.           = FALSE - INSERT is not active
  1905.  
  1906. See Also: kbd_insert_on kbd_is_all_on kbd_is_caps_on kbd_is_num_on kbd_is_scroll_on
  1907.  
  1908. --------------------------------------------------------------------------------
  1909.                                                                         KEYBOARD
  1910. boolean kbd_is_num_on(void);
  1911. Function: Report if NUM LOCK is active.
  1912.  
  1913. Return Value: = TRUE  - NUM LOCK is active
  1914.           = FALSE - NUM LOCK is not active
  1915.  
  1916. See Also: kbd_num_on kbd_is_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_scroll_on
  1917.  
  1918. --------------------------------------------------------------------------------
  1919.                                                                         KEYBOARD
  1920. boolean kbd_is_scroll_on(void);
  1921. Function: Report if SCROLL LOCK is active.
  1922.  
  1923. Return Value: = TRUE  - SCROLL LOCK is active
  1924.           = FALSE - SCROLL LOCK is not active
  1925.  
  1926. See Also: kbd_scroll_on kbd_is_all_on kbd_is_caps_on kbd_is_insert_on kbd_is_num_on
  1927.  
  1928. --------------------------------------------------------------------------------
  1929.                                                                         KEYBOARD
  1930. boolean kbd_is_shift(void);
  1931. Function: Report if either shift is depressed.
  1932.  
  1933. boolean kbd_is_shift_only(void);
  1934. Function: Report if only a shift is depressed (and not an alt or a ctrl).
  1935.  
  1936. boolean kbd_is_shift_left(void);
  1937. Function: Report if the left shift is depressed.
  1938.  
  1939. boolean kbd_is_shift_left_only(void);
  1940. Function: Report if only the left shift is depressed (and not the right shift,
  1941.           an alt, or a ctrl).
  1942.  
  1943. boolean kbd_is_shift_right(void);
  1944. Function: Report if the right shift is depressed.
  1945.  
  1946. boolean kbd_is_shift_right_only(void);
  1947. Function: Report if only the right shift is depressed (and not the left shift,
  1948.           an alt, or a ctrl).
  1949.  
  1950. Return Value: = kbd_is_shift            - TRUE  a shift is depressed
  1951.                                     - FALSE a shift is not depressed
  1952.               = kbd_is_shift_only       - TRUE  only a shift is depressed
  1953.                                     - FALSE shift is not the only mode key
  1954.                                             depressed
  1955.               = kbd_is_shift_left       - TRUE  left shift is depressed
  1956.                                     - FALSE left shift is not depressed
  1957.               = kbd_is_shift_left_only  - TRUE  only left shift is depressed
  1958.                                     - FALSE left shift is not the only mode
  1959.                                             key depressed
  1960.               = kbd_is_shift_right      - TRUE  right shift is depressed
  1961.                                     - FALSE right shift is not depressed
  1962.               = kbd_is_shift_right_only - TRUE  only right shift is depressed
  1963.                                     - FALSE right shift is not the only mode
  1964.                                             key depressed
  1965.  
  1966. See Also: kbd_is_alt kbd_is_ctrl
  1967.  
  1968. --------------------------------------------------------------------------------
  1969.                                                                         KEYBOARD
  1970. void kbd_num_off(void);
  1971. Function: Disable the NUM LOCK key and turns off its light.
  1972.  
  1973. void kbd_num_on(void);
  1974. Function: Enable the NUM LOCK key and turns on its light.
  1975.  
  1976. See Also: kbd_is_num_on kbd_all_off kbd_caps_off kbd_insert_off kbd_scroll_off
  1977.  
  1978. --------------------------------------------------------------------------------
  1979.                                                                         KEYBOARD
  1980. void kbd_rate(byte rate, byte delay);
  1981. Function: Set typematic rate and typematic delay for repeat-key action.
  1982.  
  1983. Arguments: = typematic rate "rate" determines how many characters per second are
  1984.              printed, according to the following chart:
  1985. +------+-----------++------+-----------++------+-----------++------+-----------+
  1986. | rate | chars/sec || rate | chars/sec || rate | chars/sec || rate | chars/sec |
  1987. +------+-----------++------+-----------++------+-----------++------+-----------+
  1988. |    0 | 30.0      ||    8 | 15.0      ||   16 | 7.5       ||   24 | 3.7       |
  1989. |    1 | 26.7      ||    9 | 13.3      ||   17 | 6.7       ||   25 | 3.3       |
  1990. |    2 | 24.0      ||   10 | 12.0      ||   18 | 6.0       ||   26 | 3.0       |
  1991. |    3 | 21.8      ||   11 | 10.9      ||   19 | 5.5       ||   27 | 2.7       |
  1992. |    4 | 20.0      ||   12 | 10.0      ||   20 | 5.0       ||   28 | 2.5       |
  1993. |    5 | 18.5      ||   13 | 9.2       ||   21 | 4.6       ||   29 | 2.3       |
  1994. |    6 | 17.1      ||   14 | 8.6       ||   22 | 4.3       ||   30 | 2.1       |
  1995. |    7 | 16.0      ||   15 | 8.0       ||   23 | 4.0       ||   31 | 2.0       |
  1996. +------+-----------++------+-----------++------+-----------++------+-----------+
  1997.            = typematic delay "delay" determines how many milliseconds before the
  1998.              the repeat-key action begins, according to the following chart:
  1999.              +-------+----------+
  2000.              | delay | millisec |
  2001.              +-------+----------+
  2002.              |     0 | 250      |
  2003.              |     1 | 500      |
  2004.              |     2 | 750      |
  2005.              |     3 | 1000     |
  2006.              +-------+----------+
  2007.  
  2008. --------------------------------------------------------------------------------
  2009.                                                                         KEYBOARD
  2010. void kbd_scroll_off(void);
  2011. Function: Disable the SCROLL LOCK key and turns off its light.
  2012.  
  2013. void kbd_scroll_on(void);
  2014. Function: Enable the SCROLL LOCK key and turns on its light.
  2015.  
  2016. See Also: kbd_is_scroll_on kbd_all_off kbd_caps_off kbd_insert_off kbd_num_off
  2017.  
  2018. --------------------------------------------------------------------------------
  2019.                                                                         KEYBOARD
  2020. void kbd_status_load(void);
  2021. Function: Restore the previously saved keyboard status of insert, caps lock, num
  2022.           lock, and scroll lock
  2023.  
  2024. void kbd_status_save(void);
  2025. Function: Save the current keyboard status of insert, caps lock, num lock, and
  2026.           scroll lock
  2027.  
  2028. --------------------------------------------------------------------------------
  2029.                                                                         KEYBOARD
  2030. void kbd_take(void);
  2031. Function: Take control of the keyboard interrupt.
  2032.  
  2033. See Also: kbd_give
  2034.  
  2035. ---------------------------------------------------------------------------------
  2036.                                                                         KEYBOARD
  2037. char getchr(void);
  2038. Function: Get the next available keypress; if none available, wait for one.
  2039.  
  2040. char getchre(byte x, byte y);
  2041. Function: Get the next available keypress and echo it to the screen; if no
  2042.       keypress available, wait for one.
  2043.  
  2044. Arguments: = getchre - the character in the buffer is printed at "x","y"
  2045.  
  2046. Notes: "getchr" and "getchre" store the ASCII and scan codes of the character
  2047.        in the keyboard buffer into the structure "asciiscan" (see Global Type
  2048.        Definitions for a description of the structure "asciiscan").
  2049.  
  2050. Return Value: = getchr  - ASCII code of character retrieved from keyboard
  2051.                 getchre -   buffer
  2052.  
  2053. See Also: kbd_hit
  2054.  
  2055. ================================================================================
  2056.  
  2057.  
  2058. ===============================-----------------================================
  2059. --------------------------------  LINKED LIST  ---------------------------------
  2060.                                -----------------
  2061. llist *lst_find(llist *node, llist *list);
  2062. Function: Search for a node of a linked list.
  2063.  
  2064. Arguments: = search for node "node" in linked list "list"
  2065.  
  2066. Return Value: = "node" of linked list
  2067.               = NULL if "node" not found in linked list
  2068.  
  2069. See Also: lst_end
  2070.  
  2071. --------------------------------------------------------------------------------
  2072.                                                                      LINKED LIST
  2073. llist_double *lst_free_double(llist_double *list);
  2074. Function: Deallocate each node of a doubly linked list.
  2075.  
  2076. Arguments: = deallocate doubly linked list "list"
  2077.  
  2078. Return Value: = NULL
  2079.  
  2080. See Also: lst_free_single lst_unlink_double
  2081.  
  2082. --------------------------------------------------------------------------------
  2083.                                                                      LINKED LIST
  2084. llist_single *lst_free_single(llist_single *list);
  2085. Function: Deallocate each node of a singly linked list.
  2086.  
  2087. Arguments: = deallocate singly linked list "list"
  2088.  
  2089. Return Value: = NULL
  2090.  
  2091. See Also: lst_end lst_free_double
  2092.  
  2093. --------------------------------------------------------------------------------
  2094.                                                                      LINKED LIST
  2095. llist *lst_tail(llist *list);
  2096. Function: Return the tail of a linked list.
  2097.  
  2098. Arguments: = use linked list "list"
  2099.  
  2100. Return Value: = tail of linked list
  2101.  
  2102. See Also: lst_find lst_free_single
  2103.  
  2104. --------------------------------------------------------------------------------
  2105.                                                                      LINKED LIST
  2106. llist_double *lst_unlink_double(llist_double **head, llist_double *unlink);
  2107. Function: Unlink a node from a doubly linked list.
  2108.  
  2109. Arguments: = unlink node "unlink" from doubly linked list who's head is pointed
  2110.              to by "head"
  2111.  
  2112. Return Value: = next node in linked list
  2113.               = NULL if no further nodes in linked list
  2114.  
  2115. See Also: lst_free_double lst_unlink_single
  2116.  
  2117. --------------------------------------------------------------------------------
  2118.                                                                      LINKED LIST
  2119. llist_single *lst_unlink_single(llist_single **head, llist_single *unlink);
  2120. Function: Unlink a node from a singly linked list.
  2121.  
  2122. Arguments: = unlink node "unlink" from singly linked list who's head is pointed
  2123.              to by "head"
  2124.  
  2125. Return Value: = next node in linked list
  2126.               = NULL if no further nodes in linked list
  2127.  
  2128. See Also: lst_unlink_double
  2129.  
  2130. ================================================================================
  2131.  
  2132.  
  2133. ==================================----------====================================
  2134. -----------------------------------  MATH  -------------------------------------
  2135.                   ----------
  2136. byte max_byte(word nums, byte num1, ...);
  2137. Function: Return the maximum of a list of bytes.
  2138.  
  2139. int max_int(word nums, int num1, ...);
  2140. Function: Return the maximum of a list of integers.
  2141.  
  2142. shortint max_shortint(word nums, shortint num1, ...);
  2143. Function: Return the maximum of a list of short integers.
  2144.  
  2145. word max_word(word nums, word num1, ...);
  2146. Function: Return the maximum of a list of words.
  2147.  
  2148. Arguments: = number of numbers "nums", beginning with "num1"
  2149.  
  2150. Return Value: = greatest number of the list
  2151.  
  2152. See Also: min_byte
  2153.  
  2154. --------------------------------------------------------------------------------
  2155.                                         MATH
  2156. byte min_byte(word nums, byte num1, ...);
  2157. Function: Return the minimum of a list of bytes.
  2158.  
  2159. int min_int(word nums, int num1, ...);
  2160. Function: Return the minimum of a list of integers.
  2161.  
  2162. shortint min_shortint(word nums, shortint num1, ...);
  2163. Function: Return the minimum of a list of short integers.
  2164.  
  2165. word min_word(word nums, word num1, ...);
  2166. Function: Return the minimum of a list of words.
  2167.  
  2168. Arguments: = number of numbers "nums", beginning with "num1"
  2169.  
  2170. Return Value: = smallest number of the list
  2171.  
  2172. See Also: max_byte
  2173.  
  2174. ================================================================================
  2175. ----------------------------------  MATRIX  -------------------------------------
  2176.  
  2177. matrix3 *m3_add( matrix3 *A, matrix3 *B, matrix3 *C )
  2178. Function: Add two 3x3 matrices.
  2179.  
  2180. Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" + "B"
  2181.  
  2182. Notes: "C" is assigned the return value.
  2183.  
  2184. Return Value: = A + B
  2185.  
  2186. See Also: m3_mul m3_sub m4_add
  2187.  
  2188. --------------------------------------------------------------------------------
  2189.                                                                           MATRIX
  2190. matrix3 *m3_det( matrix3 *A, matrix3 *B )
  2191. Function: Return the determinant of a 3x3 matrix.
  2192.  
  2193. Arguments: = 3x3 matrix "B" equals the determinant of the 3x3 matrix "A"
  2194.  
  2195. Notes: "B" is assigned the return value.
  2196.  
  2197. Return Value: = det(B)
  2198.  
  2199. See Also: m4_det
  2200.  
  2201. --------------------------------------------------------------------------------
  2202.                                                                           MATRIX
  2203. matrix3 *m3_div( matrix3 *A, matrix3 *B, matrix3 *C )
  2204. Function: Divide two 3x3 matrices.
  2205.  
  2206. Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" / "B"
  2207.  
  2208. Notes: "C" is assigned the return value.
  2209.  
  2210. Return Value: = A / B
  2211.  
  2212. See Also: m3_mul m3_sub m4_div
  2213.  
  2214. --------------------------------------------------------------------------------
  2215.                                                                           MATRIX
  2216. matrix3 *m3_inv( matrix3 *A, matrix3 *B )
  2217. Function: Return the inverse of a 3x3 matrix.
  2218.  
  2219. Arguments: = 3x3 matrix "B" equals the inverse of the 3x3 matrix "A"
  2220.  
  2221. Notes: "B" is assigned the return value.
  2222.  
  2223.                   -1
  2224. Return Value: = B^   or inv(B)
  2225.  
  2226. See Also: m4_inv
  2227.  
  2228. --------------------------------------------------------------------------------
  2229.                                                                           MATRIX
  2230. matrix3 *m3_mul( matrix3 *A, matrix3 *B, matrix3 *C )
  2231. Function: Multiply two 3x3 matrices.
  2232.  
  2233. Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" * "B"
  2234.  
  2235. Notes: "C" is assigned the return value.
  2236.  
  2237. Return Value: = A * B
  2238.  
  2239. See Also: m3_add m3_div m4_mul
  2240.  
  2241. --------------------------------------------------------------------------------
  2242.                                                                           MATRIX
  2243. matrix3 *m3_sub( matrix3 *A, matrix3 *B, matrix3 *C )
  2244. Function: Subtract two 3x3 matrices.
  2245.  
  2246. Arguments: = 3x3 matrix "C" equals 3x3 matrices "A" - "B"
  2247.  
  2248. Notes: "C" is assigned the return value.
  2249.  
  2250. Return Value: = A - B
  2251.  
  2252. See Also: m3_div m3_add m4_sub
  2253.  
  2254. --------------------------------------------------------------------------------
  2255.                                                                           MATRIX
  2256. matrix3 *m3_transpose( matrix3 *A, matrix3 *B)
  2257. Function: Transpose a 3x3 matrix.
  2258.  
  2259. Arguments: = 3x3 matrix "B" equals the transpose of the 3x3 matrices "A"
  2260.  
  2261. Notes: "B" is assigned the return value.
  2262.  
  2263. Return Value: = transpose(A)
  2264.  
  2265. See Also: m4_transpose
  2266.  
  2267. --------------------------------------------------------------------------------
  2268.                                                                           MATRIX
  2269. matrix4 *m4_add( matrix4 *A, matrix4 *B, matrix4 *C )
  2270. Function: Add two 4x4 matrices.
  2271.  
  2272. Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" + "B"
  2273.  
  2274. Notes: "C" is assigned the return value.
  2275.  
  2276. Return Value: = A + B
  2277.  
  2278. See Also: m3_add m4_mul m4_sub
  2279.  
  2280. --------------------------------------------------------------------------------
  2281.                                                                           MATRIX
  2282. matrix4 *m4_det( matrix4 *A, matrix4 *B )
  2283. Function: Return the determinant of a 4x4 matrix.
  2284.  
  2285. Arguments: = 4x4 matrix "B" equals the determinant of the 4x4 matrix "A"
  2286.  
  2287. Notes: "B" is assigned the return value.
  2288.  
  2289. Return Value: = det(B)
  2290.  
  2291. See Also: m3_det
  2292.  
  2293. --------------------------------------------------------------------------------
  2294.                                                                           MATRIX
  2295. matrix4 *m4_div( matrix4 *A, matrix4 *B, matrix4 *C )
  2296. Function: Divide two 4x4 matrices.
  2297.  
  2298. Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" / "B"
  2299.  
  2300. Notes: "C" is assigned the return value.
  2301.  
  2302. Return Value: = A / B
  2303.  
  2304. See Also: m3_div m4_mul m4_sub
  2305.  
  2306. --------------------------------------------------------------------------------
  2307.                                                                           MATRIX
  2308. matrix4 *m4_mul( matrix4 *A, matrix4 *B, matrix4 *C )
  2309. Function: Multiply two 4x4 matrices.
  2310.  
  2311. Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" * "B"
  2312.  
  2313. Notes: "C" is assigned the return value.
  2314.  
  2315. Return Value: = A * B
  2316.  
  2317. See Also: m3_mul
  2318.  
  2319. --------------------------------------------------------------------------------
  2320.                                                                           MATRIX
  2321. matrix4 *m4_inv( matrix4 *A, matrix4 *B )
  2322. Function: Return the inverse of a 4x4 matrix.
  2323.  
  2324. Arguments: = 4x4 matrix "B" equals the inverse of the 4x4 matrix "A"
  2325.  
  2326. Notes: "B" is assigned the return value.
  2327.  
  2328.                   -1
  2329. Return Value: = B^   or inv(B)
  2330.  
  2331. See Also: m3_inv
  2332.  
  2333. --------------------------------------------------------------------------------
  2334.                                                                           MATRIX
  2335. matrix4 *m4_sub( matrix4 *A, matrix4 *B, matrix4 *C )
  2336. Function: Subtract two 4x4 matrices.
  2337.  
  2338. Arguments: = 4x4 matrix "C" equals 4x4 matrices "A" - "B"
  2339.  
  2340. Notes: "C" is assigned the return value.
  2341.  
  2342. Return Value: = A - B
  2343.  
  2344. See Also: m3_sub m4_div m4_add
  2345.  
  2346. --------------------------------------------------------------------------------
  2347.                                                                           MATRIX
  2348. matrix4 *m4_transpose( matrix4 *A, matrix4 *B)
  2349. Function: Transpose a 4x4 matrix.
  2350.  
  2351. Arguments: = 4x4 matrix "B" equals the transpose of the 4x4 matrices "A"
  2352.  
  2353. Notes: "B" is assigned the return value.
  2354.  
  2355. Return Value: = transpose(A)
  2356.  
  2357. See Also: m3_transpose
  2358.  
  2359. ================================================================================
  2360. --------------------------------  2D VECTORS  ----------------------------------
  2361.  
  2362. vector2 *v2_add( vector2 *u, vector2 *v, vector2 *w )
  2363. Function: Add two 2D vectors.
  2364.  
  2365. Arguments: = 2D vector "w" equals 2D vectors "u" + "v"
  2366.  
  2367. Notes: "w" is assigned the return value.
  2368.  
  2369. Return Value: = u + v
  2370.  
  2371. See Also: v3_add
  2372.  
  2373. --------------------------------------------------------------------------------
  2374.                                                                       2D VECTORS
  2375. vector2 *v2_combine( vector2 *u, double c1,
  2376.                      vector2 *v, double c2, vector2 *w )
  2377. Function: Return the linear combination of two 2D vectors.
  2378.  
  2379. Arguments: = 2D vector "w" equals scalar constant "c1" * 2D vector "u"
  2380.              + scalar constant "c2" * 2D vector "v"
  2381.  
  2382. Notes: "w" is assigned the return value.
  2383.  
  2384. Return Value: = c1(u) + c2(v)
  2385.  
  2386. See Also: v3_combine
  2387.  
  2388. --------------------------------------------------------------------------------
  2389.                                                                       2D VECTORS
  2390. vector2 *v2_copy( vector2 *v )
  2391. Function: Make a copy of a 2D vector.
  2392.  
  2393. Arguments: = a copy is made of the 2D vector "v"
  2394.  
  2395. Return Value: = copy of 2D vector "v"
  2396.  
  2397. See Also: v2_new v3_copy
  2398.  
  2399. --------------------------------------------------------------------------------
  2400.                                                                       2D VECTORS
  2401. double v2_dot( vector2 *u, vector2 *v )
  2402. Function: Return the dot product of two 2D vectors.
  2403.  
  2404. Arguments: = 2D vector "w" equals 2D vectors "u" dot "v"
  2405.  
  2406. Notes: "w" is assigned the return value.
  2407.  
  2408. Return Value: = u dot v
  2409.  
  2410. See Also: v3_dot
  2411.  
  2412. --------------------------------------------------------------------------------
  2413.                                                                       2D VECTORS
  2414. double v2_len( vector2 *v )
  2415. Function: Return the magnitude (length) of a 2D vector.
  2416.  
  2417. Arguments: = length of the 2D vector "v" is returned
  2418.  
  2419. Return Value: = length of v
  2420.  
  2421. See Also: v3_len
  2422.  
  2423. --------------------------------------------------------------------------------
  2424.                                                                       2D VECTORS
  2425. double v2_len_sqr( vector2 *v )
  2426. Function: Return the magnitude of a 2D vector squared (squared length).
  2427.  
  2428. Arguments: = use 2D vector "v"
  2429.  
  2430. Return Value: = squared length of "v"
  2431.  
  2432. See Also: v3_len_sqr
  2433.  
  2434. --------------------------------------------------------------------------------
  2435.                                                                       2D VECTORS
  2436. vector2 *v2_lerp( vector2 *lo, vector2 *hi, double alpha, vector2 *w )
  2437. Function: Linearly interpolate between two 2D vectors by some amount.
  2438.  
  2439. Arguments: = 2D vector "w" equals linear interpolation between two 2D vectors
  2440.              "lo" and "hi" by amount "alpha"
  2441.  
  2442. Notes: When "alpha" = 0, "w" = "lo".  When "alpha" = 1, "w" = "hi".
  2443.  
  2444. Return Value: = linear interpolation between lo and hi by alpha
  2445.  
  2446. See Also: v3_lerp
  2447.  
  2448. --------------------------------------------------------------------------------
  2449.                                                                       2D VECTORS
  2450. vector2 *v2_mul( vector2 *u, vector2 *v, vector2 *w )
  2451. Function: Multiply two 2D vectors component-wise.
  2452.  
  2453. Arguments: = 2D vector "w" equals 2D vectors "u" * "v"
  2454.  
  2455. Notes: "w" is assigned the return value.
  2456.  
  2457. Return Value: = u * v
  2458.  
  2459. See Also: v3_mul
  2460.  
  2461. --------------------------------------------------------------------------------
  2462.                                                                       2D VECTORS
  2463. Point2 *v2_mul_by_proj( Point2 *p, matrix3 *A, Point2 *q )
  2464. Function: Multiply a point by a projection matrix and return the transformed
  2465.           point.
  2466.  
  2467. Arguments: = 2D point "q" equals 2D point "p" * projection matrix "A"
  2468.  
  2469. Notes: "q" is assigned the return value.
  2470.  
  2471. Return Value: = p * A
  2472.  
  2473. See Also: v3_mul_by_proj
  2474.  
  2475. --------------------------------------------------------------------------------
  2476.                                                                       2D VECTORS
  2477. vector2 *v2_neg( vector2 *v )
  2478. Function: Negate a 2D vector.
  2479.  
  2480. Arguments: = 2D vector "v" is negated
  2481.  
  2482. Notes: "v" is assigned the return value.
  2483.  
  2484. Return Value: = -v
  2485.  
  2486. See Also: v3_neg
  2487.  
  2488. --------------------------------------------------------------------------------
  2489.                                                                       2D VECTORS
  2490. vector2 *v2_new( double x, double y )
  2491. Function: Create and initialize a new 2D vector.
  2492.  
  2493. Arguments: = new 2D vector initialized to ("x","y")
  2494.  
  2495. Return Value: = new 2D vector
  2496.  
  2497. See Also: v2_copy v3_new
  2498.  
  2499. --------------------------------------------------------------------------------
  2500.                                                                       2D VECTORS
  2501. vector2 *v2_norm( vector2 *v )
  2502. Function: Normalize a 2D vector (becomes unit length).
  2503.  
  2504. Arguments: = 2D vector "v" is normalized.
  2505.  
  2506. Notes: "v" is assigned the return value.
  2507.  
  2508. Return Value: = normal v
  2509.  
  2510. See Also: v3_norm
  2511.  
  2512. --------------------------------------------------------------------------------
  2513.                                                                       2D VECTORS
  2514. vector2 *v2_ortho( vector2 *u, vector2 *v )
  2515. Function: Return some orthogonal (perpendicular) 2D vector to a 2D vector.
  2516.  
  2517. Arguments: = 2D vector "v" equals some orthogonal vector to 2D vectur "u"
  2518.  
  2519. Notes: "v" is assigned the return value.
  2520.  
  2521. Return Value: = some orthogonal vector to "u"
  2522.  
  2523. See Also: v3_ortho
  2524.  
  2525. --------------------------------------------------------------------------------
  2526.                                                                       2D VECTORS
  2527. vector2 *v2_scale( vector2 *v, double newlen )
  2528. Function: Scale a 2D vector to some new length.
  2529.  
  2530. Arguments: = 2D vector "v" is scaled to length "newlen"
  2531.  
  2532. Notes: "v" is assigned the return value.
  2533.  
  2534. Return Value: = v scaled to length newlen
  2535.  
  2536. See Also: v3_scale
  2537. --------------------------------------------------------------------------------
  2538.                                                                       2D VECTORS
  2539. double v2_seg_len( Point2 *p, Point2 *q )
  2540. Function: Return the distance between two 2D points (length of line segment).
  2541.  
  2542. Arguments: = 2D points "p" and "q" form endpoints line segment
  2543.  
  2544. Return Value: = length of line segment pq
  2545.  
  2546. See Also: v3_segment_length
  2547.  
  2548. --------------------------------------------------------------------------------
  2549.                                                                       2D VECTORS
  2550. vector2 *v2_sub( vector2 *u, vector2 *v, vector2 *w )
  2551. Function: Subtract two 2D vectors.
  2552.  
  2553. Arguments: = 2D vector "w" equals 2D vectors "u" - "v"
  2554.  
  2555. Notes: "w" is assigned the return value.
  2556.  
  2557. Return Value: = u - v
  2558.  
  2559. See Also: v3_sub
  2560.  
  2561. ================================================================================
  2562. --------------------------------  3D VECTORS  ----------------------------------
  2563.  
  2564. vector3 *v3_add( vector3 *u, vector3 *v, vector3 *w )
  2565. Function: Add two 3D vectors.
  2566.  
  2567. Arguments: = 3D vector "w" equals 3D vectors "u" + "v"
  2568.  
  2569. Notes: "w" is assigned the return value.
  2570.  
  2571. Return Value: = u + v
  2572.  
  2573. See Also: v2_add
  2574.  
  2575. --------------------------------------------------------------------------------
  2576.                                                                       3D VECTORS
  2577. vector3 *v3_combine( vector3 *u, double c1,
  2578.                      vector3 *v, double c3, vector3 *w )
  2579. Function: Return the linear combination of two 3D vectors.
  2580.  
  2581. Arguments: = 3D vector "w" equals scalar constant "c1" * 3D vector "u"
  2582.              + scalar constant "c3" * 3D vector "v"
  2583.  
  2584. Notes: "w" is assigned the return value.
  2585.  
  2586. Return Value: = c1(u) + c3(v)
  2587.  
  2588. See Also: v2_combine
  2589.  
  2590. --------------------------------------------------------------------------------
  2591.                                                                       3D VECTORS
  2592. vector3 *v3_copy( vector3 *v )
  2593. Function: Make a copy of a 3D vector.
  2594.  
  2595. Arguments: = a copy is made of the 3D vector "v"
  2596.  
  2597. Return Value: = copy of 3D vector "v"
  2598.  
  2599. See Also: v2_copy v3_new
  2600.  
  2601. --------------------------------------------------------------------------------
  2602.                                                                       3D VECTORS
  2603. double v3_dot( vector3 *u, vector3 *v )
  2604. Function: Return the dot product of two 3D vectors.
  2605.  
  2606. Arguments: = 3D vector "w" equals 3D vectors "u" dot "v"
  2607.  
  2608. Notes: "w" is assigned the return value.
  2609.  
  2610. Return Value: = u dot v
  2611.  
  2612. See Also: v2_dot
  2613.  
  2614. --------------------------------------------------------------------------------
  2615.                                                                       3D VECTORS
  2616. double v3_len( vector3 *v )
  2617. Function: Return the magnitude (length) of a 3D vector.
  2618.  
  2619. Arguments: = length of the 3D vector "v" is returned
  2620.  
  2621. Return Value: = length of v
  2622.  
  2623. See Also: v2_len
  2624.  
  2625. --------------------------------------------------------------------------------
  2626.                                                                       3D VECTORS
  2627. double v3_len_sqr( vector3 *v )
  2628. Function: Return the magnitude of a 3D vector squared (squared length).
  2629.  
  2630. Arguments: = use 3D vector "v"
  2631.  
  2632. Return Value: = squared length of "v"
  2633.  
  2634. See Also: v2_len_sqr
  2635.  
  2636. --------------------------------------------------------------------------------
  2637.                                                                       3D VECTORS
  2638. vector3 *v3_lerp( vector3 *lo, vector3 *hi, double alpha, vector3 *w )
  2639. Function: Linearly interpolate between two 3D vectors by some amount.
  2640.  
  2641. Arguments: = 3D vector "w" equals linear interpolation between two 3D vectors
  2642.              "lo" and "hi" by amount "alpha"
  2643.  
  2644. Notes: When "alpha" = 0, "w" = "lo".  When "alpha" = 1, "w" = "hi".
  2645.  
  2646. Return Value: = linear interpolation between lo and hi by alpha
  2647.  
  2648. See Also: v2_lerp
  2649.  
  2650. --------------------------------------------------------------------------------
  2651.                                                                       3D VECTORS
  2652. vector3 *v3_mul( vector3 *u, vector3 *v, vector3 *w )
  2653. Function: Multiply two 3D vectors component-wise.
  2654.  
  2655. Arguments: = 3D vector "w" equals 3D vectors "u" * "v"
  2656.  
  2657. Notes: "w" is assigned the return value.
  2658.  
  2659. Return Value: = u * v
  2660.  
  2661. See Also: v2_mul v3_mul_by_proj
  2662.  
  2663. --------------------------------------------------------------------------------
  2664.                                                                       3D VECTORS
  2665. Point3 *v3_mul_by_proj( Point3 *p, matrix3 *A, Point3 *q )
  2666. Function: Multiply a point by a projection matrix and return the transformed
  2667.           point.
  2668.  
  2669. Arguments: = 3D point "q" equals 3D point "p" * projection matrix "A"
  2670.  
  2671. Notes: "q" is assigned the return value.
  2672.  
  2673. Return Value: = p * A
  2674.  
  2675. See Also: v2_mul_by_proj v3_mul_by_matrix
  2676.  
  2677. --------------------------------------------------------------------------------
  2678.                                                                       3D VECTORS
  2679. Point3 *v3_mul_by_matrix( Point3 *p, matrix3 *A, Point3 *q )
  2680. Function: Multiply a point by a matrix and return the transformed point.
  2681.  
  2682. Arguments: = 3D point "q" equals 3D point "p" * matrix "A"
  2683.  
  2684. Notes: "q" is assigned the return value.
  2685.  
  2686. Return Value: = p * A
  2687.  
  2688. See Also: v3_mul_by_proj
  2689.  
  2690. --------------------------------------------------------------------------------
  2691.                                                                       3D VECTORS
  2692. vector3 *v3_neg( vector3 *v )
  2693. Function: Negate a 3D vector.
  2694.  
  2695. Arguments: = 3D vector "v" is negated
  2696.  
  2697. Notes: "v" is assigned the return value.
  2698.  
  2699. Return Value: = -v
  2700.  
  2701. See Also: v2_neg
  2702.  
  2703. --------------------------------------------------------------------------------
  2704.                                                                       3D VECTORS
  2705. vector3 *v3_new( double x, double y )
  2706. Function: Create and initialize a new 3D vector.
  2707.  
  2708. Arguments: = new 3D vector initialized to ("x","y")
  2709.  
  2710. Return Value: = new 3D vector
  2711.  
  2712. See Also: v2_new v3_copy
  2713.  
  2714. --------------------------------------------------------------------------------
  2715.                                                                       3D VECTORS
  2716. vector3 *v3_norm( vector3 *v )
  2717. Function: Normalize a 3D vector (becomes unit length).
  2718.  
  2719. Arguments: = 3D vector "v" is normalized.
  2720.  
  2721. Notes: "v" is assigned the return value.
  2722.  
  2723. Return Value: = normal v
  2724.  
  2725. See Also: v2_norm
  2726.  
  2727. --------------------------------------------------------------------------------
  2728.                                                                       3D VECTORS
  2729. vector3 *v3_ortho( vector3 *u, vector3 *v )
  2730. Function: Return some orthogonal (perpendicular) 3D vector to a 3D vector.
  2731.  
  2732. Arguments: = 3D vector "v" equals some orthogonal vector to 3D vectur "u"
  2733.  
  2734. Notes: "v" is assigned the return value.
  2735.  
  2736. Return Value: = some orthogonal vector to "u"
  2737.  
  2738. See Also: v2_ortho
  2739.  
  2740. --------------------------------------------------------------------------------
  2741.                                                                       3D VECTORS
  2742. vector3 *v3_scale( vector3 *v, double newlen )
  2743. Function: Scale a 3D vector to some new length.
  2744.  
  2745. Arguments: = 3D vector "v" is scaled to length "newlen"
  2746.  
  2747. Notes: "v" is assigned the return value.
  2748.  
  2749. Return Value: = v scaled to length newlen
  2750.  
  2751. See Also: v2_scale
  2752.  
  2753. --------------------------------------------------------------------------------
  2754.                                                                       3D VECTORS
  2755. double v3_seg_len( Point3 *p, Point3 *q )
  2756. Function: Return the distance between two 3D points (length of line segment).
  2757.  
  2758. Arguments: = 3D points "p" and "q" form endpoints line segment
  2759.  
  2760. Return Value: = length of line segment pq
  2761.  
  2762. See Also: v2_segment_length
  2763.  
  2764. --------------------------------------------------------------------------------
  2765.                                                                       3D VECTORS
  2766. vector3 *v3_sub( vector3 *u, vector3 *v, vector3 *w )
  2767. Function: Subtract two 3D vectors.
  2768.  
  2769. Arguments: = 3D vector "w" equals 3D vectors "u" - "v"
  2770.  
  2771. Notes: "w" is assigned the return value.
  2772.  
  2773. Return Value: = u - v
  2774.  
  2775. See Also: v2_sub
  2776.  
  2777. ================================================================================
  2778.  
  2779.  
  2780. =============================---------------------==============================
  2781. -------------------------------  MISCELLANEOUS  --------------------------------
  2782.                              ---------------------
  2783. void beep(void);
  2784. Function: Beep the internal speaker.
  2785.  
  2786. Notes: This procedure is useful for signifying an error by the user or to
  2787.        attract the user's attention.
  2788.  
  2789. --------------------------------------------------------------------------------
  2790.                                                                    MISCELLANEOUS
  2791. byte bestlib_init(byte mode, boolean mouse);
  2792. Function: Initialize THE BEST LIBRARY and set default values.
  2793.  
  2794. Arguments: = will change to video mode "mode"
  2795.              - FALSE   does not change the video mode
  2796.              - [value] any number that represents a video mode
  2797.              - TEXT    change to a text mode if not already in one
  2798.              - TEXT25  change to 25-line color or monochrome mode (depending
  2799.                        on the display adapter installed) if not already in it
  2800.              - TEXT50  change to 50-line color mode if not already in it
  2801.              - TEXT25F change to 25-line color or monochrome mode (depending
  2802.                        on the display adapter installed) regardless of whether
  2803.                        or not already in it
  2804.              - TEXT50F change to 50-line color mode regardless of whether or
  2805.                        not already in it
  2806.              - VGA16   change to 640x480 16 color graphics mode
  2807.              - VGA256  change to 320x200 256 color graphics mode
  2808.            = if "mouse" equals
  2809.              - TRUE  - initializes mouse to video mode "mode" (if "mode" =
  2810.                        FALSE, initializes to current video mode) by a call to
  2811.                        "ms_init"
  2812.              - FALSE - does not initialize mouse
  2813.  
  2814. Notes: "bestlib_init" sets up necessary default internal values; run it before
  2815.        using any functions from THE BEST LIBRARY.  The following default
  2816.        global variables are initialized:
  2817.                   blink = TRUE
  2818.            txt_cur_move = TRUE
  2819.        If "bestlib_init" is called from a text mode, it fills the structure
  2820.        "cursor" and saves the text video memory by a call to
  2821.        "txt_mem(TEXTSAVE, NULL)".  The delay counter is initialized to the
  2822.        speed of the computer by a call to "msec".
  2823.  
  2824. Return Value: = previous video mode if the video mode was changed (if not
  2825.                 changed, then "bestlib_init" returns the current video mode)
  2826.  
  2827. See Also: _video_set
  2828.  
  2829. --------------------------------------------------------------------------------
  2830.                                                                    MISCELLANEOUS
  2831. void boot(word how);
  2832. Function: Either warm or cold boot the system.
  2833.  
  2834. Arguments: = will boot the computer according to "how":
  2835.              - WARM  warm boot the system
  2836.              - COLD  cold boot the system
  2837.  
  2838. Notes: A warm boot is the same as pressing Ctrl-Alt-Del -- a cold boot is the
  2839.        same as pressing the reset button.  WARNING  a cold boot should not be
  2840.        performed unless all disk activity has completed (this includes disk
  2841.        caching).
  2842.  
  2843. Return Value: None.
  2844.  
  2845. --------------------------------------------------------------------------------
  2846.                                                                    MISCELLANEOUS
  2847. char *dos_shell(void);
  2848. Function: Shell to DOS, returning upon the user typing "EXIT".
  2849.  
  2850. Notes: Performs an exhaustive search for the file COMMAND.COM, searching first
  2851.        for COMSPEC= in the DOS environment string and the entire PATH.  If not
  2852.        found, "dos_shell" searches the current path, C:\, C:\DOS, and finally
  2853.        C:\BIN.  If COMMAND.COM is still not found, "dos_shell" aborts and
  2854.        returns the fifth error message (of the messages displayed below) to the
  2855.        calling program.
  2856.  
  2857.        The program screen is not restored upon the user typing "EXIT", this is
  2858.        the program's responsibility.  The video mode, however, is restored.
  2859.  
  2860. Return Value: = NULL if successful
  2861.               = a pointer to the error message if unsuccessful
  2862.         - possible error messages:
  2863.           - Bad argument passed to COMMAND.COM
  2864.           - Too many arguments passed to COMMAND.COM
  2865.           - Internal error -- exitting to DOS is strongly recommended
  2866.           - Out of memory -- cannot shell to DOS
  2867.           - Cannot find file COMMAND.COM -- initialize COMSPEC=[path]COMMAND.COM
  2868.  
  2869. Example Program: Prints up a simple menu system.  The first and second menu
  2870. EXAMP001.EXE     options have no real function, as this is just an example.
  2871.                  It waits for the user to select an option and, unless the
  2872.                  exit option was selected, will prompt the user for another
  2873.                  selection.
  2874.  
  2875. --------------------------------------------------------------------------------
  2876.                                                                    MISCELLANEOUS
  2877. void msec(int delaytime);
  2878. Function: Delay the computer for a specific number of milliseconds.
  2879.  
  2880. Arguments: = delays the computer for "delaytime" milliseconds
  2881.              (1000 milliseconds = 1 second)
  2882.  
  2883. Notes: This procedure is CPU-independent, meaning it will delay for one
  2884.        millisecond on a dinosaur 4.77mhz 8088 machine and a super-power 100mhz
  2885.        586/pentium machine.  The first call to this function initializes itself
  2886.        to the specific computer.
  2887.  
  2888. See Also: stopw
  2889.  
  2890. Example Program: This program animates some text around the screen, performing
  2891. EXAMP003.EXE     a pause between each move using the procedure msec.
  2892.  
  2893. --------------------------------------------------------------------------------
  2894.                                                                    MISCELLANEOUS
  2895. void sound_off(void);
  2896. Function: Stop any sound coming from the speaker.
  2897.  
  2898. --------------------------------------------------------------------------------
  2899.                                                                    MISCELLANEOUS
  2900. boolean stopw(byte index, word delaytime);
  2901. Function: Initialize a stopwatch to a specific clock-tick delay.
  2902.  
  2903. Arguments: = "index" refers to a stopwatch (a unique "index" for each stopwatch)
  2904.              - must be between 0 and 99 inclusive
  2905.            = the stopwatch will be set to count down from "delaytime" clock
  2906.              ticks (1 clock tick = 55 milliseconds, 1 second = 18.2 clock ticks)
  2907.              - if "delaytime" = FALSE, will read the state of stopwatch "index"
  2908.  
  2909. Notes: This procedure is CPU-independent, meaning it will delay for one clock
  2910.        tick on a dinosaur 4.77mhz 8088 machine and a super-power 100mhz 80586
  2911.        machine.  The first call to this function initializes itself to the
  2912.        specific computer.  It is very useful if you do not wish your program
  2913.        to stop everything and wait for a period of time.  Instead of returning
  2914.        control when the desired delay time has expired, as the procedure msec
  2915.        does, control is returned immediately.  The only disadvantage of stopw
  2916.        is the minimum delay is 55 milliseconds, or 55 thousandths of a second
  2917.        (msec has a minimum delay of one millisecond, or one thousandth of a
  2918.        second).
  2919.  
  2920. Return Value: = if "delaytime" is FALSE will return
  2921.                 -  TRUE if stopwatch "index" is finished
  2922.                 - FALSE if stopwatch "index" is not finished
  2923. See Also: msec
  2924.  
  2925. Example Program: This program sets a random delay for each rock to stay
  2926. EXAMP004.EXE     stationary using the stopw function.  When this delay has
  2927.                  expired, the rock is moved and a new random delay is set.
  2928.  
  2929. --------------------------------------------------------------------------------
  2930.                                                                    MISCELLANEOUS
  2931. byte video_get(void);
  2932. Function: Read the current state of the video adapter.
  2933.  
  2934. void video_set(byte mode);
  2935. Function: Change the video mode.
  2936.  
  2937. Arguments: = video_set - "mode" represents the video mode to change to
  2938.                          - [value] any number that represents a video mode
  2939.                          - TEXT    change to a text mode if not already in one
  2940.                          - TEXT25  change to 25-line color or monochrome mode
  2941.                                    (depending on the display adapter
  2942.                                    installed) if not already in it
  2943.                          - TEXT50  change to 50-line color mode if not already
  2944.                                    in it
  2945.                          - TEXT25F change to 25-line color or monochrome mode
  2946.                                    (depending on the display adapter
  2947.                                    installed) regardless of whether or not
  2948.                                    already in it
  2949.                          - TEXT50F change to 50-line color mode regardless of
  2950.                                    whether or not already in it
  2951.                          - VGA16   change to 640x480  16 color graphics mode
  2952.                          - VGA256  change to 320x200 256 color graphics mode
  2953.  
  2954. Notes: Both functions call the ROM-BIOS to get/set the video mode.  If already
  2955.        in a text mode and "mode" equals TEXT25F or TEXT50F, the text video
  2956.        memory is cleared to a BLACK background and LIGHTGREY foreground by the
  2957.        ROM-BIOS.  "video_set" will reset the active and visual video page to
  2958.        0.  NOTE  you must re-initialize to mouse with a call to "ms_init" to
  2959.        the new video mode.  Do not input random values for "mode" in
  2960.        "video_set" because some monitors and video cards are susceptible to
  2961.        permanent damage if forced into a mode they were not designed for.
  2962.  
  2963. Return Value: = video_get - current video mode (same as the "mode"s, used in
  2964.                             video_set, except TEXT25F/TEXT50F are returned as
  2965.                             TEXT25/TEXT50 respectively)
  2966.  
  2967. See Also: bestlib_init txt_mem txt_rows
  2968.  
  2969. Example Program:
  2970.  
  2971. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  2972. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  2973.  
  2974. void main(void)
  2975. {
  2976.    int oldmode;
  2977.  
  2978.    bestlib_init(TEXT25);                 /* initialize THE BEST LIBRARY       */
  2979.    oldmode = video_get();                /* save the old video mode           */
  2980.  
  2981.    /* the actual program code would go here... */
  2982.  
  2983.    video_set(oldmode);                   /* restore the original video mode   */
  2984.    exit(0);                              /* exit to DOS with errorlevel 0     */
  2985. }
  2986. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  2987.  
  2988. ================================================================================
  2989.  
  2990.  
  2991. =================================-------------==================================
  2992. -----------------------------------  MOUSE  ------------------------------------
  2993.                                  -------------
  2994.  
  2995. void ms_get(int *x, int *y);
  2996. Function: Store the location of the mouse cursor.
  2997.  
  2998. int ms_getx(void);
  2999. Function: Return the mouse cursor abscissa.
  3000.  
  3001. int ms_gety(void);
  3002. Function: Return the mouse cursor ordinate.
  3003.  
  3004. Arguments: = ms_get  - stores mouse cursor abscissa into "x" and mouse cursor
  3005.                         ordinate into "y"
  3006.                         - if mouse is in text mode, assumes (byte *x, byte *y)
  3007.                       - if "y" is NULL, "x" is assumed to be "int *xy" (or
  3008.                         byte *xy if mouse is in text mode), a data structure
  3009.                         that has "x" and "y" as consecutive integers/bytes
  3010.  
  3011. Notes: ms_getx and ms_gety return byte value if the mouse cursor was
  3012.        initialized in text mode.
  3013.  
  3014. Return Value: = ms_getx - abscissa of mouse cursor
  3015.               = ms_gety - ordinate of mouse cursor
  3016.  
  3017. See Also: cur_get ms_set ms_setx ms_sety
  3018.  
  3019. --------------------------------------------------------------------------------
  3020.                                                                            MOUSE
  3021. void ms_hide(void);
  3022. Function: Hide the mouse cursor.
  3023.  
  3024. Notes: This procedure works in text and graphics mode.  Always hide the mouse
  3025.        cursor in graphics mode before performing any update to the screen.
  3026.        The mouse cursor does not have to be hidden during a text mode update
  3027.        if that update does not modify the attribute of a character.
  3028.  
  3029. See Also: ms_show
  3030.  
  3031. --------------------------------------------------------------------------------
  3032.                                                                            MOUSE
  3033. boolean ms_init(byte mode);
  3034. Function: Initialize the mouse driver.
  3035.  
  3036. Arguments: = "mode" determines the video mode the mouse will operate in:
  3037.              - [value] any number that represents a video mode
  3038.              - TEXT25  25-line text mode
  3039.              - TEXT50  50-line text mode
  3040.              - VGA16   640x480 16 color graphics mode
  3041.              - VGA256  320x200 256 color graphics mode
  3042.  
  3043. Notes: The global variable "mousepresent" is set to the return value.  The
  3044.        mouse cursor is centered on the screen (coordinates are stored in
  3045.        "mousedata.npos[0]","mousedata.npos[1]") and is hidden (use ms_show to
  3046.        display the cursor).  The movement range of the mouse cursor is set to
  3047.        the screen dimensions.  See Global Type Definitions for a description
  3048.        of the structure "mousedata".
  3049.  
  3050. Return Value: = TRUE  if mouse driver is detected and initialized
  3051.               = FALSE if mouse driver is not detected
  3052.  
  3053. See Also: video_set
  3054.  
  3055. --------------------------------------------------------------------------------
  3056.                                                                            MOUSE
  3057. boolean ms_kill(void);
  3058. Function: Completely disable the mouse driver so that it must be reloaded to
  3059.           be used again.
  3060.  
  3061. Notes: It is rarely to use this procedure.  It is included if the need arises.
  3062.  
  3063. Return Value: = TRUE if successful
  3064.               = FALSE if failed
  3065.  
  3066. --------------------------------------------------------------------------------
  3067.                                                                            MOUSE
  3068. void ms_range(int minx, int miny, int maxx, int maxy);
  3069. Function: Set the mouse cursor's minimum and maximum range of movement.
  3070.  
  3071. Arguments: = minimum x-range is set to "minx" and the maximum to "maxx"
  3072.              - if "minx" = MIN, minimum abscissa is set to the screen minimum
  3073.              - if "maxx" = MAX, maximum abscissa is set to the screen maximum
  3074.            = minimum y-range is set to "miny" and the maximum to "maxy"
  3075.              - if "miny" = MIN, minimum ordinate is set to the screen minimum
  3076.              - if "maxy" = MAX, maximum ordinate is set to the screen maximum
  3077.  
  3078. Notes: The mouse cursor will not move beyond the set range.
  3079.        +----------------+--------+--------+-------+--------+
  3080.        |                | TEXT25 | TEXT50 | VGA16 | VGA256 |
  3081.        +----------------+--------+--------+-------+--------+
  3082.        | movement range |  0-79  |  0-79  | 0-639 | 0-319  |
  3083.        | movement range |  0-24  |  0-49  | 0-479 | 0-199  |
  3084.        +----------------+--------+--------+-------+--------+
  3085.        
  3086. --------------------------------------------------------------------------------
  3087.                                                                            MOUSE
  3088. void ms_set(int x, int y);
  3089. Function: Set the mouse cursor's abscissa and ordinate.
  3090.  
  3091. int ms_setx(int x);
  3092. Function: Set the mouse cursor's abscissa.
  3093.  
  3094. int ms_sety(int y);
  3095. Function: Set the mouse cursor's ordinate.
  3096.  
  3097. Arguments: = ms_set  - sets mouse abscissa,ordinate to "x","y"
  3098.              ms_setx - sets mouse abscissa to "x"
  3099.              ms_sety - sets mouse ordinate to "y"
  3100.            = if "x" = MEM, "mousedata.npos[0]" is used
  3101.            = if "y" = MEM, "mousedata.npos[1]" is used
  3102.  
  3103. Notes: If values are supplied for either "x" or "y", they are stored into
  3104.        "mousedata.npos[0]" or "mousedata.npos[1]", respectively.  See Global
  3105.        Type Definitions for a description of the structure "mousedata".
  3106.  
  3107. Return Value: = ms_setx - mouse ordinate
  3108.               = ms_sety - mouse abscissa
  3109.  
  3110. --------------------------------------------------------------------------------
  3111.                                                                            MOUSE
  3112. void ms_shape(byte fgclr, byte bgclr, char ch);
  3113. Function: Change the mouse character.
  3114.  
  3115. Arguments: = the mouse cursor is changed to the ASCII code "ch"
  3116.        = the foreground color of the mouse cursor becomes "fgclr"
  3117.              - if "fgclr" = NO, the foreground color is XORed (ie. a white
  3118.                foreground would result in a black-foreground mouse cursor).
  3119.        = the background color of the mouse cursor becomes "bgclr"
  3120.              - if "bgclr" = NO, the background color is XORed (ie. a black
  3121.                background would result in a white-background mouse cursor).
  3122.  
  3123. Notes: This procedure changes the ASCII code that represents the mouse cursor
  3124.        and works only in text mode.
  3125.  
  3126. --------------------------------------------------------------------------------
  3127.                                                                            MOUSE
  3128. void ms_show(void);
  3129. Function: Display the mouse cursor.
  3130.  
  3131. Notes: "ms_show" cancels one "ms_hide"; for every "ms_hide" called, an
  3132.        "ms_show" must be called (ie. if "ms_hide" was called three times in
  3133.        a row, to display the mouse cursor, "ms_show" must be called three
  3134.        times in a row).
  3135.  
  3136. See Also: ms_hide
  3137.  
  3138. --------------------------------------------------------------------------------
  3139.                                                                            MOUSE
  3140. void ms_stat(void);
  3141. Function: Store detailed information about the mouse's status.
  3142.  
  3143. Notes: Updates the button status and mouse cursor position information in
  3144.        "msdata.nbuts" and "msdata.npos", respectively.
  3145.  
  3146. ================================================================================
  3147.  
  3148.  
  3149. ================================--------------==================================
  3150. ----------------------------------  STRING  ------------------------------------
  3151.                                 --------------
  3152. char case_down(char ch);
  3153. Function: Return the lowercase of a letter.
  3154.  
  3155. char case_down_ptr(char *ch);
  3156. Function: Convert a letter to lowercase.
  3157.  
  3158. char case_flip(char ch);
  3159. Function: Return the opposite case of a letter.
  3160.  
  3161. char case_flip_ptr(char *ch);
  3162. Function: Convert a letter to the opposite case.
  3163.  
  3164. char case_up(char ch);
  3165. Function: Return the UPPERCASE of a letter.
  3166.  
  3167. char case_up_ptr(char *ch);
  3168. Function: Convert a letter to uppercase.
  3169.  
  3170. Arguments: = case_down     - the letter "ch" is returned as lowercase
  3171.            = case_down_ptr - the letter "ch" is converted to lowercase
  3172.            = case_flip     - the letter "ch" is returned as the opposite case
  3173.            = case_flip_ptr - the letter "ch" is converted to the opposite case
  3174.            = case_up       - the letter "ch" is returned as UPPERCASE
  3175.            = case_up_ptr   - the letter "ch" is converted to UPPERCASE
  3176.  
  3177. Return Value: = case_down/case_down_ptr - the lowercase of "ch"
  3178.                 - "ch" if "ch" is not an UPPERCASE letter
  3179.               = case_flip/case_flip_ptr - the opposite case of "ch"
  3180.                 - "ch" if "ch" is not a letter
  3181.               = case_up/case_up_ptr   - the UPPERCASE of "ch"
  3182.                 - "ch" if "ch" is not a lowercase letter
  3183.  
  3184. See Also: is_case_down is_case_up
  3185.  
  3186. Example Program:
  3187.  
  3188. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3189. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3190.  
  3191. void main(void)
  3192. {
  3193.    char ch, ch2 = 'V';
  3194.  
  3195.    bestlib_init();                       /* initialize THE BEST LIBRARY       */
  3196.    ch = case_up('g');                    /* "ch" will equal 'G'               */
  3197.    ch = case_down(ch2);                  /* "ch" will equal 'v'               */
  3198.    ch = case_flip('h');                  /* "ch" will equal 'H'               */
  3199.    case_down_ptr(&ch2);                  /* "ch2" will equal 'v'              */
  3200.    case_up_ptr(&ch);                     /* "ch2" will equal 'V'              */
  3201.    case_flip_ptr(&ch2);                  /* "ch2" will equal 'v'              */
  3202. }
  3203. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3204.  
  3205. --------------------------------------------------------------------------------
  3206.                                                                           STRING
  3207. boolean is_number_dec(char *str);
  3208. Function: Check if a string is a decimal number.
  3209.  
  3210. boolean is_number_hex(char *str);
  3211. Function: Check if a string is a hexadecimal number.
  3212.  
  3213. Return Value: = is_digit_dec  - TRUE  if "ch" is a decimal digit
  3214.                               - FALSE if "ch" is not a decimal digit
  3215.               = is_digit_hex  - TRUE  if "ch" is a hexadecimal digit
  3216.                               - FALSE if "ch" is not a hexadecimal digit
  3217. See Also: is_alpha
  3218.  
  3219. --------------------------------------------------------------------------------
  3220.                                                                           STRING
  3221. void mem_copy(void *destination, void *source, word bytes);
  3222. Function: Make a copy of a memory location.
  3223.  
  3224. Arguments: = copy "bytes" bytes from "source" into "destination"
  3225.  
  3226. See Also: str_copy
  3227.  
  3228. --------------------------------------------------------------------------------
  3229.                                                                           STRING
  3230. word scan_byte(char *start, char compare, word count, boolean direction);
  3231. Function: Search for a one-byte value.
  3232.  
  3233. word scan_bytes(char *start, char compare[], word count, boolean direction);
  3234. Function: Search for one of several one-byte values.
  3235.  
  3236. Arguments: = searches "count" bytes, starting at address
  3237.              "start"
  3238.              - if "count" = NULL, searches the length of string
  3239.                "start"
  3240.            = searches in direction "direction"
  3241.              - FORWARD  - forward direction
  3242.              - BACKWARD - reverse direction
  3243.            = scan_byte  - searches for the one-byte value "compare",
  3244.                           starting at "start"
  3245.            = scan_bytes - searches for any one of the one-byte values
  3246.                           "compare", starting at "start"
  3247.  
  3248. Notes: "scan_bytes":  the array must be NULL-terminated.  The return value is
  3249.        an integer offset, not a pointer.  Add (or subtract if "direction" =
  3250.        BACKWARD) this offset to "start" to derive a pointer to one
  3251.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3252.        match was found).  It is set to one past because if it were set to the
  3253.        correct offset, then if a match was found at "start", the
  3254.        function would return 0, which means FALSE (no match).
  3255.  
  3256. Return Value: = offset + 1 of first byte value matching "compare"
  3257.               = FALSE      if no match found
  3258.  
  3259. See Also: scan_byte_not scan_str scan_word scan_word_not(Example Program)
  3260.  
  3261. Example Program:
  3262. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3263. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3264.  
  3265. void main(void)
  3266. {
  3267.    word offset;
  3268.    char *string = "Today is a bright day.";
  3269.  
  3270.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3271.    offset = scan_byte(string, 'd', NULL, FORWARD);            /* "offset" = 3 */
  3272. }
  3273. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3274.  
  3275. --------------------------------------------------------------------------------
  3276.                                                                           STRING
  3277. word scan_byte_not(char *start, char compare, word count, boolean direction);
  3278. Function: Search for any other one-byte value.
  3279.  
  3280. word scan_bytes_not(char *start, char compare[],
  3281.                     word count, boolean direction);
  3282. Function: Search for any other one-byte value.
  3283.  
  3284. Arguments: = searches "count" bytes, starting at address
  3285.              "start"
  3286.              - if "count" = NULL, searches the length of string
  3287.                "start"
  3288.            = searches in direction "direction"
  3289.              - FORWARD  - forward direction
  3290.              - BACKWARD - reverse direction
  3291.            = scan_byte_not  - searches for any one-byte value other than
  3292.                               "compare", starting at "start"
  3293.            = scan_bytes_not - searches for any one-byte value other than those
  3294.                               in "compare", starting at "start"
  3295.  
  3296. Notes: "scan_bytes_not":  the array must be NULL-terminated.  The return value
  3297.        is an integer offset, not a pointer.  Add (or subtract if "direction" =
  3298.        BACKWARD) this offset to "start" to derive a pointer to one
  3299.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3300.        match was found).  It is set to one past because if it were set to the
  3301.        correct offset, then if a match was found at "start", the
  3302.        function would return 0, which means FALSE (no match).
  3303.  
  3304. Return Value: = offset + 1 of first byte value not matching "compare"
  3305.               = FALSE      if only "compare" present
  3306.  
  3307. See Also: scan_byte scan_word_not(Example Program)
  3308.  
  3309. Example Program:
  3310. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3311. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3312.  
  3313. void main(void)
  3314. {
  3315.    word offset;
  3316.    char *string = " Today is a cloudy day.";
  3317.  
  3318.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3319.    offset = scan_byte_not(string, ' ', NULL, FORWARD);        /* "offset" = 2 */
  3320. }
  3321. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3322.  
  3323. --------------------------------------------------------------------------------
  3324.                                                                           STRING
  3325. word scan_str(char *start, char *compare, word count, boolean direction);
  3326. Function: Search for a string of characters.
  3327.  
  3328. word scan_strs(char *start, char *compare[], word count, boolean direction);
  3329. Function: Search for any one of several strings of characters.
  3330.  
  3331. Arguments: = searches "count" bytes, starting at address
  3332.              "start"
  3333.              - if "count" = NULL, searches the length of string
  3334.                "start"
  3335.            = searches in direction "direction"
  3336.              - FORWARD  - forward direction
  3337.              - BACKWARD - reverse direction
  3338.            = scan_str  - searches for the string "compare", starting at
  3339.                          "start"
  3340.            = scan_strs - searches for any one of the strings "compare",
  3341.                          starting at "start"
  3342.  
  3343. Notes: "scan_strs":  the array must be NULL-terminated.  The return value is
  3344.        an integer offset, not a pointer.  Add (or subtract if "direction" =
  3345.        BACKWARD) this offset to "start" to derive a pointer to one
  3346.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3347.        match was found).  It is set to one past because if it were set to the
  3348.        correct offset, then if a match was found at "start", the
  3349.        function would return 0, which means FALSE (no match).
  3350.  
  3351. Return Value: = offset + 1 of first string matching "compare"
  3352.               = FALSE      if no match found or
  3353.                            if either "compare" or "start" are not
  3354.                            strings
  3355.  
  3356. See Also: scan_byte scan_word scan_word_not(Example Program), str_fill_byte
  3357.  
  3358. Example Program:
  3359. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3360. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3361.  
  3362. void main(void)
  3363. {
  3364.    word offset;
  3365.    char string[] = "Today is a HOT day.";
  3366.  
  3367.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3368.    offset = scan_str(start, "is", NULL, FORWARD);             /* "offset" = 7 */
  3369. }
  3370. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3371.  
  3372. --------------------------------------------------------------------------------
  3373.                                                                           STRING
  3374. word scan_str_not(char *start, char *compare, word count, boolean direction);
  3375. Function: Search for any other string of characters.
  3376.  
  3377. word scan_strs_not(char *start, char *compare[],
  3378.                    word count, boolean direction);
  3379. Function: Search for any other string of characters.
  3380.  
  3381. Arguments: = searches "count" bytes, starting at address
  3382.              "start"
  3383.              - if "count" = NULL, searches the length of string
  3384.                "start"
  3385.            = searches in direction "direction"
  3386.              - FORWARD  - forward direction
  3387.              - BACKWARD - reverse direction
  3388.            = scan_str_not  - searches for any string other than "compare",
  3389.                              starting at "start"
  3390.            = scan_strs_not - searches for any string other than those in
  3391.                              "compare", starting at "start"
  3392.  
  3393. Notes: "scan_strs_not":  the array must be NULL-terminated.  The return value
  3394.        is an integer offset, not a pointer.  Add (or subtract if "direction" =
  3395.        BACKWARD) this offset to "start" to derive a pointer to one
  3396.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3397.        match was found).  It is set to one past because if it were set to the
  3398.        correct offset, then if a match was found at "start", the
  3399.        function would return 0, which means FALSE (no match).
  3400.  
  3401. Return Value: = offset + 1 of first string matching "compare"
  3402.               = FALSE      if no match found or
  3403.                            if either "compare" or "start" are not
  3404.                            strings
  3405.  
  3406. See Also: scan_byte scan_word scan_word_not(Example Program)
  3407.  
  3408. Example Program:
  3409. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3410. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3411.  
  3412. void main(void)
  3413. {
  3414.    word offset;
  3415.    char string[] = "Today is a HOT day.";
  3416.  
  3417.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3418.    offset = scan_str(string, "is", NULL, FORWARD);            /* "offset" = 7 */
  3419. }
  3420. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3421.  
  3422. --------------------------------------------------------------------------------
  3423.                                                                           STRING
  3424. word scan_word(word *start, word compare, word count, boolean direction);
  3425. Function: Search for a one-word (two-byte) value.
  3426.  
  3427. word scan_words(word *start, word compare[], word count, boolean direction);
  3428. Function: Search for one of several one-word (two-byte) values.
  3429.  
  3430. Arguments: = searches "count" bytes, starting at address
  3431.              "start"
  3432.            = searches in direction "direction"
  3433.              - FORWARD  - forward direction
  3434.              - BACKWARD - reverse direction
  3435.            = scan_word  - searches for the one-word value "compare"
  3436.            = scan_words - searches for any one of the one-word values in
  3437.                           "compare"
  3438.  
  3439. Notes: "scan_words":  the array must be NULL-terminated.  The search is
  3440.        performed one word (two bytes) at a time.  Therefore, "start"
  3441.        should always point to integer-only arrays of data.  The return value
  3442.        is an integer offset, not a pointer.  Add (or subtract if "direction" =
  3443.        BACKWARD) this offset to "start" to derive a pointer to one
  3444.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3445.        match was found).  It is set to one past because if it were set to the
  3446.        correct offset, then if a match was found at "start", the
  3447.        function would return 0, which means FALSE (no match).
  3448.  
  3449. Return Value: = offset + 1 of first word-value matching "compare"
  3450.               = FALSE      if no match found or if "count" = 0
  3451.  
  3452. See Also: scan_byte scan_str scan_word_not(Example Program)
  3453.  
  3454. Example Program:
  3455. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3456. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3457.  
  3458. void main(void)
  3459. {
  3460.    word offset, numbers[] = { 4, 16, 64, 256, 1024 };
  3461.  
  3462.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3463.    offset = scan_word(numbers, 16, 5, FORWARD);               /* "offset" = 2 */
  3464. }
  3465. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3466.  
  3467. --------------------------------------------------------------------------------
  3468.                                                                           STRING
  3469. word scan_word_not(word *start, word compare, word count, boolean direction);
  3470. Function: Search for any other one-word (two-byte) value.
  3471.  
  3472. word scan_words_not(word *start, word compare[],
  3473.                     word count, boolean direction);
  3474. Function: Search for any other one-word (two-byte) value.
  3475.  
  3476. Arguments: = searches for any one-word value other than "compare" for
  3477.              "count" bytes, starting at address "start"
  3478.            = searches in direction "direction"
  3479.              - FORWARD  - forward direction
  3480.              - BACKWARD - reverse direction
  3481.            = scan_word_not  - searches for any one-word value other than
  3482.                               "compare"
  3483.            = scan_words_not - searches for any one-word value other than
  3484.                               those in "compare"
  3485.  
  3486. Notes: "scan_words_not":  the array must be NULL-terminated.  The search is
  3487.        performed one word (two bytes) at a time.  Therefore, "start"
  3488.        should always point to integer-only arrays of data.  The return value
  3489.        is an integer offset, not a pointer.  Add (or subtract if "direction" =
  3490.        BACKWARD) this offset to "start" to derive a pointer to one
  3491.        past (or one before if "direction" = BACKWARD) the match (assuming a
  3492.        match was found).  It is set to one past because if it were set to the
  3493.        correct offset, then if a match was found at "start", the
  3494.        function would return 0, which means FALSE (no match).
  3495.  
  3496. Return Value: = offset + 1 of first word-value not matching "compare"
  3497.               = FALSE      if only "compare" present
  3498.  
  3499. See Also: scan_byte_not scan_word
  3500.  
  3501. Example Program:
  3502. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3503. #include <!bestlib.h>                    /* include !BESTLIB.H in compilation */
  3504.  
  3505. void main(void)
  3506. {
  3507.    word offset, numbers[] = { 4, 3, 3, 5, 2, 2, 6, 1, 1 };
  3508.  
  3509.    bestlib_init(FALSE, FALSE);                 /* initialize THE BEST LIBRARY */
  3510.    offset = scan_word_not(numbers+1, 3, 9, FORWARD);          /* "offset" = 3 */
  3511.    /* NOTE  "offset" is the RELATIVE offset from the beginning of the scan; a
  3512.             non-3 number occurs at absolute position 4, but because we started
  3513.             our scan from the second number, "offset" = 3                     */
  3514. }
  3515. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
  3516.  
  3517. --------------------------------------------------------------------------------
  3518.                                                                           STRING
  3519. int sign(int number);
  3520. Function: Read the sign of a number.
  3521.  
  3522. Arguments: = the sign of the number "number" is returned
  3523.  
  3524. Return Value: = +1 if the sign of the number "number" is positive
  3525.               =  0 if the number "number" is zero
  3526.               = -1 if the sign of the number "number" is negative
  3527.  
  3528. --------------------------------------------------------------------------------
  3529.                                                                           STRING
  3530. void str_add(char *str);
  3531. Function: Add to a number stored as an ASCII string.
  3532.  
  3533. void str_dec(char *str);
  3534. Function: Decrement a number stored as an ASCII string.
  3535.  
  3536. void str_div(char *str);
  3537. Function: Divide a number stored as an ASCII string.
  3538.  
  3539. void str_inc(char *str);
  3540. Function: Increment a number stored as an ASCII string.
  3541.  
  3542. void str_mul(char *str);
  3543. Function: Multiply a number stored as an ASCII string.
  3544.  
  3545. void str_sub(char *str);
  3546. Function: Subtract from a number stored as an ASCII string.
  3547.  
  3548. Arguments: = ASCII number "str" is modified
  3549.  
  3550. Notes: If the number is its greatest possible, these functions will roll it back
  3551.        to zero (ie. strinc("99") would result in "00").  These functions greatly
  3552.        simplify the process of mathematically manipulating string numerals.
  3553.  
  3554. --------------------------------------------------------------------------------
  3555.                                                                           STRING
  3556. int str_case_down(char *str);
  3557. Function: Convert all characters in a string to lowercase.
  3558.  
  3559. int str_case_down_pr(printdata *prdata);
  3560. Function: Convert all characters in "prdata.string" to lowercase.
  3561.  
  3562. int str_case_flip(char *str);
  3563. Function: Convert all characters in a string to the opposite case.
  3564.  
  3565. int str_case_flip_pr(printdata *prdata);
  3566. Function: Convert all characters in "prdata.string" to the opposite case.
  3567.  
  3568. int str_case_up(char *str);
  3569. Function: Convert all characters in a string to uppercase.
  3570.  
  3571. int str_case_up_pr(printdata *prdata);
  3572. Function: Convert all characters in "prdata.string" to uppercase.
  3573.  
  3574. Arguments: = str_case_down    - convert characters in string "str" to lowercase
  3575.            = str_case_down_pr - convert characters in string "prdata.string"
  3576.                                 to lowercase
  3577.            = str_case_flip    - convert characters in string "str" to the
  3578.                                 opposite case
  3579.            = str_case_flip_pr - convert characters in string "prdata.string"
  3580.                                 to the opposite case
  3581.            = str_case_up      - convert characters in string "str" to
  3582.                                 uppercase
  3583.            = str_case_up_pr   - convert characters in string "prdata.string"
  3584.                                 to lowercase
  3585. Notes: See Global Type Definitions for a description of the structure
  3586.        "printdata".
  3587.  
  3588. Return Value: = length of string
  3589.  
  3590. --------------------------------------------------------------------------------
  3591.                                                                           STRING
  3592. int str_cmp(char *str1, char *str2);
  3593. Function: Compare two strings.
  3594.  
  3595. Arguments: = compares the string "str1" to the string "str2"
  3596.  
  3597. Return Value: = +1 if "str1" is alphabetically greater than "str2"
  3598.               =  0 if "str1" and "str2" are the same
  3599.               = -1 if "str1" is alphabetically less than "str2"
  3600.  
  3601. Example Program: This program prompts the user to enter a password.  The
  3602. EXAMP005.EXE     user's input is compared to the valid password using the
  3603.                  str_cmp function.
  3604.  
  3605. --------------------------------------------------------------------------------
  3606.                                                                           STRING
  3607.  
  3608. word str_copy(char *destination, char *source);
  3609. Function: Copies a string.
  3610.  
  3611. Arguments: = copies string "source" into string "destination"
  3612.  
  3613. Notes: The destination does not have to be of type "char":
  3614.          int dest[16];
  3615.          char *source = "This is a test";
  3616.          str_copy((char *)dest, source);
  3617.        Remember to use a type cast when "destination" is not of type "char".
  3618.  
  3619. Return Value: = length of "source"
  3620.  
  3621. See Also: mem_copy
  3622.  
  3623. --------------------------------------------------------------------------------
  3624.                                                                           STRING
  3625. void str_dec(char *str);
  3626.  
  3627. [see str_add]
  3628.  
  3629. --------------------------------------------------------------------------------
  3630.                                                                           STRING
  3631. void str_del_byte(char *start, char del, word count);
  3632. Function: Delete all occurrences of a byte from a string.
  3633.  
  3634. void str_del_str(char *start, char *del, word count);
  3635. Function: Delete all occurences of a string from a string.
  3636.  
  3637. void str_del_word(word *start, word del, word count);
  3638. Function: Delete all occurrences of a word from an array of word-values.
  3639.  
  3640. Arguments: = str_del_byte - every occurrence of byte-value "del" is searched
  3641.                             for, starting from "start", and deleted, scanning
  3642.                             through "count" bytes
  3643.                             - if "count" = NULL, searches to the end of string
  3644.                               "start"
  3645.              str_del_str  - every occurrence of string "del" is searched for,
  3646.                             starting from "start", and deleted, scanning
  3647.                             through "count" bytes
  3648.                             - if "count" = NULL, searches to the end of string
  3649.                               "start"
  3650.              str_del_word - every occurrence of word-value "del" is searched
  3651.                             for, starting from "start", and deleted, scanning
  3652.                             through "count" words
  3653.  
  3654. Notes: These functions perform exactly like pressing the Del key in a word
  3655.        processor on every occurrence of a value.
  3656.  
  3657. See Also: str_del_bytes str_rep_byte_byte
  3658.  
  3659. --------------------------------------------------------------------------------
  3660.                                                                           STRING
  3661. void str_del_bytes(char *start, word count);
  3662. Function: Delete bytes from a string.
  3663.  
  3664. void str_del_words(word *start, word count);
  3665. Function: Delete words from an array of word-values.
  3666.  
  3667. Arguments: = str_del_bytes - "count" byte-values (ie. characters), starting at
  3668.                              "start", are deleted
  3669.              str_del_words - "count" word-values (ie. integers), beginning at
  3670.                              "start", are deleted
  3671.  
  3672. Notes: These functions perform exactly like pressing the Del key in a word
  3673.        processor.
  3674.  
  3675. See Also: str_del_byte str_ins_byte
  3676.  
  3677. --------------------------------------------------------------------------------
  3678.                                                                           STRING
  3679. void str_div(char *str);
  3680.  
  3681. [see str_add]
  3682.  
  3683. --------------------------------------------------------------------------------
  3684.                                                                           STRING
  3685. void str_fill_byte(char *destination, char source, word count);
  3686. Function: Fill memory with a one-byte value.
  3687.  
  3688. void str_fill_str(char *destination, char *source, word count);
  3689. Function: Fill memory with a string of characters.
  3690.  
  3691. void str_fill_word(word *destination, word source, word count);
  3692. Function: Fill memory with a one-word (two-byte) value.
  3693.  
  3694. Arguments: = "count" sources "source" are written to memory location
  3695.              "destination"
  3696.  
  3697. Notes: No NULL-terminator is appended to "destination".
  3698.  
  3699. See Also: scan_byte
  3700.  
  3701. --------------------------------------------------------------------------------
  3702.                                                                           STRING
  3703. void str_inc(char *str);
  3704.  
  3705. [see str_add]
  3706.  
  3707. --------------------------------------------------------------------------------
  3708.                                                                           STRING
  3709. void str_ins_byte(char *start, char insert, word count);
  3710. Function: Insert a one-byte value into a string.
  3711.  
  3712. void str_ins_str(char *start, char *insert, word count);
  3713. Function: Insert a string into a string.
  3714.  
  3715. void str_ins_word(word *start, word insert, word count);
  3716. Function: Insert a one-word (two byte) value into an array of words.
  3717.  
  3718. Arguments: = str_ins_byte - "count" byte-values "insert" are inserted into
  3719.                             string "start"
  3720.              str_ins_str  - "count" strings of characters "insert" are
  3721.                             inserted into string "start"
  3722.              str_ins_word - "count" word-values "insert" are inserted into
  3723.                             the array of word-values "start"
  3724. See Also: str_del_bytes
  3725.  
  3726. --------------------------------------------------------------------------------
  3727.                                                                           STRING
  3728. word str_len(char *str);
  3729. Function: Return the length of a string.
  3730.  
  3731. word str_len_pr(printdata *prdata);
  3732. Function: Return the length of "prdata.string".
  3733.  
  3734. Arguments: = str_len    - the string "str" is counted
  3735.              str_len_pr - the string "prdata.string" is counted
  3736.  
  3737. Notes: The length of the string returned is a count of the number of letters
  3738.        of the entire string, NOT including the NULL terminating character.
  3739.        A return value of 0 can mean the string is empty, or that it is not a
  3740.        string (no NULL terminator found).
  3741.  
  3742. Return Value: = length of the string (number of characters)
  3743.  
  3744. --------------------------------------------------------------------------------
  3745.                                                                           STRING
  3746. void str_mul(char *str);
  3747.  
  3748. [see str_add]
  3749.  
  3750. --------------------------------------------------------------------------------
  3751.                                                                           STRING
  3752. char *str_next_str(char *str);
  3753. Function: Return the next string from a string.
  3754.  
  3755. char *str_next_word(char *str);
  3756. Function: Return the next word from a string.
  3757.  
  3758. Arguments: = "str" - string to read from
  3759.  
  3760. Notes: A string can consist of alphanumeric characters, hyphens, apostrophes, or
  3761.        text surrounded in quotes, like "It is: 04/12/94" -- nothing else.  A
  3762.        word can consist of only alphabet letters.
  3763.  
  3764. Return Value: = pointer to string read in
  3765.               = NULL if there was nothing to get (reached end of string)
  3766.  
  3767. --------------------------------------------------------------------------------
  3768.                                                                           STRING
  3769. void str_rep_byte_byte(char *start, char search,
  3770.                        char replace, word count, boolean direction);
  3771. Function: Search for all occurrences of a byte and replace it with a different
  3772.           byte.
  3773.  
  3774. void str_rep_byte_str(char *start, char search,
  3775.                       char *replace, word count, boolean direction);
  3776. Function: Search for all occurrences of a byte and replace it with a string.
  3777.  
  3778. void str_rep_byte_word(char *start, char search,
  3779.                        word replace, word count, boolean direction);
  3780. Function: Search for all occurrences of a byte and replace it with a word.
  3781.  
  3782. Arguments: = searches in direction "direction"
  3783.              - FORWARD  - forward direction
  3784.              - BACKWARD - reverse direction
  3785.            = str_rep_byte_byte - every occurrence of byte "search" is searched
  3786.                                  for, starting from "start", and replaced by
  3787.                                  the byte "replace", scanning through "count"
  3788.                                  "count" bytes
  3789.                                  - if "count" = NULL, searches to the end of
  3790.                                    string "start"
  3791.              str_rep_byte_str  - every occurrence of byte "search" is searched
  3792.                                  for, starting from "start", and replaced by
  3793.                                  the string "replace", scanning through
  3794.                                  "count" bytes
  3795.                                  - if "count" = NULL, searches to the end of
  3796.                                    string "start"
  3797.              str_rep_byte_word - every occurrence of byte "search" is searched
  3798.                                  for, starting from "start", and replaced by
  3799.                                  the word "replace", scanning through "count"
  3800.                                  bytes
  3801.  
  3802. Notes: WARNING: IF "count" = NULL AND "direction" = BACKWARD, THESE FUNCTIONS
  3803.        WILL SEARCH AND REPLACE BEYOND THE BEGINNING OF STRING "start"
  3804.  
  3805. See Also: str_del_byte str_rep_str_byte str_rep_word_byte
  3806.  
  3807. --------------------------------------------------------------------------------
  3808.                                                                           STRING
  3809. void str_rep_str_byte(char *start,
  3810.                       char *search, char replace, boolean direction);
  3811. Function: Search for all occurrences of a string and replace it with a byte.
  3812.  
  3813. void str_rep_str_str(char *start,
  3814.                      char *search, char *replace, boolean direction);
  3815. Function: Search for all occurrences of a string and replace it with another
  3816.           string.
  3817.  
  3818. Arguments: = searches in direction "direction"
  3819.              - FORWARD  - forward direction
  3820.              - BACKWARD - reverse direction
  3821.            = if "count" = NULL, searches to the end of string "start"
  3822.            = str_rep_str_byte - every occurrence of string "search" is
  3823.                                 searched for, starting from "start", and
  3824.                                 replaced by the byte-value "replace", scanning
  3825.                                 through "count" bytes
  3826.              str_rep_str_str  - every occurrence of string "search" is
  3827.                                 searched for, starting from "start", and
  3828.                                 replaced by the string "replace", scanning
  3829.                                 through "count" bytes
  3830.  
  3831. Notes: WARNING: IF "count" = NULL AND "direction" = BACKWARD, THESE FUNCTIONS
  3832.        WILL SEARCH AND REPLACE BEYOND THE BEGINNING OF STRING "start"
  3833.  
  3834. See Also: str_rep_byte_byte
  3835.  
  3836. --------------------------------------------------------------------------------
  3837.                                                                           STRING
  3838. void str_rep_word_byte(word *start,
  3839.                        word search, char replace, boolean direction);
  3840. Function: Search for all occurrences of a word and replace it with a byte.
  3841.  
  3842. void str_rep_word_word(word *start,
  3843.                        word search, word replace, boolean direction);
  3844. Function: Search for all occurrences of a word and replace it with another
  3845.           word.
  3846.  
  3847. Arguments: = searches in direction "direction"
  3848.              - FORWARD  - forward direction
  3849.              - BACKWARD - reverse direction
  3850.            = str_rep_word_byte - every occurrence of word "search" is searched
  3851.                                  for, starting from "start", and replaced by
  3852.                                  the byte "replace", scanning through "count"
  3853.                                  bytes
  3854.              str_rep_word_word - every occurrence of word "search" is searched
  3855.                                  for, starting from "start", and replaced by
  3856.                                  the word "replace", scanning through "count"
  3857.                                  bytes
  3858. See Also: str_rep_byte_byte
  3859.  
  3860. --------------------------------------------------------------------------------
  3861.                                                                           STRING
  3862. char str_right(char *str, word number);
  3863. Function: Read one string character, counting from the right.
  3864.  
  3865. char str_right_pr(printdata *prdata, word number);
  3866. Function: Read one "prdata.string" character, counting from the right.
  3867.  
  3868. Arguments: = str_right    - read character number "number" from string "str",
  3869.                             counting from the right
  3870.              str_right_pr - read character number "number from string
  3871.                             "prdata.string", counting from the right
  3872.  
  3873. Notes: "from the right" means from the end of the string.
  3874.          char *source = "This is a test";
  3875.          ch = str_right(source, 3);        /* ch = 'e' */
  3876.  
  3877. Return Value: = character "number" from the right of the string
  3878.  
  3879. --------------------------------------------------------------------------------
  3880.                                                                           STRING
  3881. void str_sub(char *str);
  3882.  
  3883. [see str_add]
  3884.  
  3885. ================================================================================
  3886. ---------------------------------  CHARACTER  ----------------------------------
  3887.  
  3888. boolean is_alpha(char ch);
  3889. Function: Check if a character is an alphabet letter.
  3890.  
  3891. boolean is_alpha_down(char ch);
  3892. Function: Check if a character is a lowercase alphabet letter.
  3893.  
  3894. boolean is_alpha_up(char ch);
  3895. Function: Check if a character is an uppercase alphabet letter.
  3896.  
  3897. boolean is_alphanum(char ch);
  3898. Function: Check if a character is an alphanumeric character.
  3899.  
  3900. boolean is_ascii(char ch);
  3901. Function: Check if a character is a standard ASCII character.
  3902.  
  3903. boolean is_case_down(char ch);
  3904. Function: Check if a character is a lowercase letter.
  3905.  
  3906. boolean is_case_up(char ch);
  3907. Function: Check if a character is an uppercase letter.
  3908.  
  3909. boolean is_ctrlchar(char ch);
  3910. Function: Check if a character is a control character (0-31 or 127).
  3911.  
  3912. boolean is_digit_dec(char ch);
  3913. Function: Check if a character is a decimal digit.
  3914.  
  3915. boolean is_digit_hex(char ch);
  3916. Function: Check if a character is a hexadecimal digit.
  3917.  
  3918. boolean is_greek(char ch);
  3919. Function: Check if a character is a greek letter.
  3920.  
  3921. boolean is_letter(char ch);
  3922. Function: Check if a character is an alphabet letter, an apostrophe, or a
  3923.           hyphen.
  3924.  
  3925. boolean is_letternum(char ch);
  3926. Function: Check if a character is an alphanumeric letter, an apostrophe, or a
  3927.           hyphen.
  3928.  
  3929. boolean is_print(char ch);
  3930. Function: Check if a character is a printable character (has an ASCII symbol).
  3931.  
  3932. boolean is_punc(char ch);
  3933. Function: Check if a character is a punctuation character.
  3934.  
  3935. Arguments: = character "ch" is checked
  3936.  
  3937. Return Value: = is_alpha      - TRUE  if "ch" is an alphabet letter
  3938.                               - FALSE if "ch" is not an alphabet letter
  3939.               = is_alpha_down - TRUE  if "ch" is a lowercase alphabet letter
  3940.                               - FALSE if "ch" is not a lowercase alphabet letter
  3941.               = is_alpha_up   - TRUE  if "ch" is an uppercase alphabet letter
  3942.                               - FALSE if "ch" isn't an uppercase alphabet letter
  3943.               = is_alphanum   - TRUE  if "ch" is an alphanumeric character
  3944.                               - FALSE if "ch" is not an alphanumeric character
  3945.               = is_ascii      - TRUE  if "ch" is a standard ASCII character
  3946.                               - FALSE if "ch" is not a standard ASCII character
  3947.               = is_case_down  - TRUE  if "ch" is a lowercase letter
  3948.                               - FALSE if "ch" is not a lowercase letter
  3949.               = is_case_up    - TRUE  if "ch" is an uppercase letter
  3950.                               - FALSE if "ch" is not an uppercase letter
  3951.               = is_ctrlchar   - TRUE  if "ch" is a control character
  3952.                               - FALSE if "ch" is not a control character
  3953.               = is_digit_dec  - TRUE  if "ch" is a decimal digit
  3954.                               - FALSE if "ch" is not a decimal digit
  3955.               = is_digit_hex  - TRUE  if "ch" is a hexadecimal digit
  3956.                               - FALSE if "ch" is not a hexadecimal digit
  3957.               = is_greek      - TRUE  if "ch" is a greek letter
  3958.                               - FALSE if "ch" is not a greek letter
  3959.               = is_letter     - TRUE  if "ch" is an alphabet letter, ', or -
  3960.                               - FALSE if "ch" is not an alphabet letter, ', or -
  3961.               = is_print      - TRUE  if "ch" is a printable character
  3962.                               - FALSE if "ch" is not a printable character
  3963.               = is_punc       - TRUE  if "ch" is a punctuation character
  3964.                               - FALSE if "ch" is not a punctuation
  3965.  
  3966. Notes: "is_alphanum" and "is_letternum" do not distinguish between decimal and
  3967.        hexadecimal number because the hexadecimal numbers are just decimal
  3968.        number + alphabet letters
  3969.  
  3970. See Also: is_number_dec
  3971.  
  3972. ================================================================================
  3973. --------------------------------  CONVERSION  ----------------------------------
  3974.  
  3975. char *con_bool_to_str(boolean bool);
  3976. Function: Convert a numerical boolean value into its string equivalent.
  3977.  
  3978. Arguments: = boolean value "bool" is converted
  3979.  
  3980. Return Value: = "TRUE"  if "bool" = TRUE
  3981.               = "FALSE" if "bool" = FALSE
  3982.  
  3983. See Also: con_color_to_str con_str_to_bool
  3984.  
  3985. --------------------------------------------------------------------------------
  3986.                                                                       CONVERSION
  3987. char *con_color_to_str(byte color);
  3988. Function: Convert a numerical color value into its string equivalent.
  3989.  
  3990. Arguments: = color value "color" is converted
  3991.  
  3992. Return Value: = string representation of color
  3993.               = NULL if "color" is not a valid color
  3994.  
  3995. See Also: con_bool_to_str con_str_to_color
  3996.  
  3997. --------------------------------------------------------------------------------
  3998.                                                                       CONVERSION
  3999. shortint con_str_to_bool(char *str);
  4000. Function: Convert a boolean word into its numerical equivalent.
  4001.  
  4002. Arguments: = "str" - boolean word to convert
  4003.  
  4004. Return Value: = TRUE  if "str" = "TRUE"
  4005.                 FALSE if "str" = "FALSE"
  4006.                 -1    if "str" is not a valid boolean word
  4007.  
  4008. See Also: con_bool_to_str con_str_to_color
  4009.  
  4010. --------------------------------------------------------------------------------
  4011.                                                                       CONVERSION
  4012. shortint con_str_to_color(char *str);
  4013. Function: Convert a color name into its numerical equivalent.
  4014.  
  4015. Arguments: = "str" - color name to convert
  4016.  
  4017. Return Value: = color value
  4018.               = -1 if "str" is not a valid color
  4019.  
  4020. See Also: con_color_to_str con_str_to_bool
  4021.  
  4022. ================================================================================
  4023.  
  4024.  
  4025. =================================------------===================================
  4026. -----------------------------------  TEXT  -------------------------------------
  4027.                                  ------------
  4028. void txt_ascii_get(word number, byte codes[]);
  4029. Function: Read in ASCII character patterns.
  4030.  
  4031. Arguments: = reads "number" character patterns into "codes"
  4032.  
  4033. Notes: See ASCII GRAPHIC DEFINITIONS for details on the internal structure of
  4034.        "codes".
  4035.  
  4036. See Also: txt_asc_set
  4037.  
  4038. --------------------------------------------------------------------------------
  4039.                                                                             TEXT
  4040. void txt_ascii_set(word number, byte codes[]);
  4041. Function: Redefine ASCII character patterns to allow for new characters.
  4042.  
  4043. Arguments: = sets "number" character patterns using data from "codes"
  4044.  
  4045. Notes: See ASCII GRAPHIC DEFINITIONS for details on the internal structure of
  4046.        "codes".
  4047.  
  4048. See Also: txt_asc_get
  4049.  
  4050. --------------------------------------------------------------------------------
  4051.                                                                             TEXT
  4052. void txt_blink(int what);
  4053. Function: Set 16 background colors or blinking characters.
  4054.  
  4055. Arguments: = if "what" = TRUE,  blinking characters are set
  4056.                        = FALSE, 16 background colors are set
  4057.  
  4058. --------------------------------------------------------------------------------
  4059.                                                                             TEXT
  4060. byte txt_char_height(void);
  4061. Function: Return the height of text mode characters (in pixels/scan lines).
  4062.  
  4063. byte txt_char_length(void);
  4064. Function: Return the length of text mode characters (in pixels).
  4065.  
  4066. Notes: Scan lines are synonymous with pixels counted vertically.
  4067.  
  4068. Return Value: = txt_char_height - height of text mode characters (in pixels)
  4069.               = txt_char_length - length of text mode characters (in pixels)
  4070.  
  4071. --------------------------------------------------------------------------------
  4072.                                                                             TEXT
  4073. void txt_cls(void);
  4074. Function: Clear the screen.
  4075.  
  4076. See Also: txt_flood
  4077.  
  4078. --------------------------------------------------------------------------------
  4079.                                                                             TEXT
  4080. byte txt_erase(byte x, byte y, byte length, byte height);
  4081. Function: Overwrite a region with spaces.
  4082.  
  4083. Arguments: = the region with a corner at "x","y", an x-length "length", and a
  4084.              y-height "height" is overwritten with spaces (ASCII 32)
  4085.  
  4086. Return Value: = ASCII value of first character overwritten
  4087.  
  4088. See Also: txt_chr_erase txt_chrs_erase txt_erase_col txt_str_erase
  4089.  
  4090. --------------------------------------------------------------------------------
  4091.                                                                             TEXT
  4092. void txt_erase_col(byte col);
  4093. Function: Overwrite one column of characters with spaces.
  4094.  
  4095. void txt_erase_row(byte col);
  4096. Function: Overwrite one row of characters with spaces.
  4097.  
  4098. Arguments: = txt_erase_col - column "col" is overwritten with spaces
  4099.            = txt_erase_row - column "row" is overwritten with spaces
  4100.  
  4101. See Also: txt_erase
  4102.  
  4103. --------------------------------------------------------------------------------
  4104.                                                                             TEXT
  4105. void txt_fill_area(byte x, byte y, filldata *fidata);
  4106. Function: Fill a screen region according to the structure "fidata".
  4107.  
  4108. Arguments: = the information in the "filldata" structure "fidata" is used
  4109.            = the filling begins at the corner "x","y"
  4110.              - if "x" = MEM, "fidata.x" is used
  4111.              - if "y" = MEM, "fidata.y" is used
  4112.  
  4113. Notes: See Global Type Definitions for a description of the structure
  4114.        "filldata".
  4115.  
  4116. See Also: txt_attrs_fill txt_chrattrs_fill txt_chrs_fill txt_fill_col
  4117.           txt_fill_row txt_flood txt_print
  4118.  
  4119. --------------------------------------------------------------------------------
  4120.                                                                             TEXT
  4121. char txt_fill_col(byte col, byte fgclr, byte bgclr, char *str);
  4122. Function: Fill a column with a string in a defined color.
  4123.  
  4124. Arguments: = string "str" is printed in foreground color "fgclr" and
  4125.              background color "bgclr" at "col",0 down the screen
  4126.              - if "fgclr" = NO, the foreground is not modified
  4127.              - if "bgclr" = NO, the background is not modified
  4128.              - if "str"   = NULL, no string is printed
  4129.  
  4130. Return Value: = ASCII value of first character overwritten
  4131.  
  4132. See Also: txt_chr_attr_show txt_fill_area txt_fill_row
  4133.  
  4134. --------------------------------------------------------------------------------
  4135.                                                                             TEXT
  4136. char txt_fill_row(byte row, byte fgclr, byte bgclr, char *str);
  4137. Function: Fill a row with a string in a defined color.
  4138.  
  4139. Arguments: = string "str" is printed in foreground color "fgclr" and
  4140.              background color "bgclr" at 0,"row" across the screen
  4141.              - if "fgclr" = NO, the foreground is not modified
  4142.              - if "bgclr" = NO, the background is not modified
  4143.              - if "str"   = NULL, no string is printed
  4144.  
  4145. Return Value: = ASCII value of first character overwritten
  4146.  
  4147. See Also: txt_chr_attr_show txt_fill_area txt_fill_col
  4148.  
  4149. --------------------------------------------------------------------------------
  4150.                                                                             TEXT
  4151. word txt_flood(byte fgclr, byte bgclr, char *str);
  4152. Function: Flood the screen with a character in a foreground/background color.
  4153.  
  4154. Arguments: = screen is flooded with string "str" -- if "str" = NULL, no string
  4155.              is used to fill the screen
  4156.            = the foreground color is set to "fgclr" -- if "fgclr" = NO, the
  4157.              foreground color is not modified
  4158.            = the background color is set to "bgclr" -- if "bgclr" = NO, the
  4159.              background color is not modified
  4160.  
  4161. Notes: To clear the screen, use the string " " (with a space), ASCII code 32.
  4162.  
  4163. Return Value: = length of "str"
  4164.  
  4165. See Also: txt_cls txt_fill_area
  4166.  
  4167. --------------------------------------------------------------------------------
  4168.                                                                             TEXT
  4169. word txt_get_abs(void);
  4170. Function: Return the offset of the text page.
  4171.  
  4172. Notes: When strictly dealing with whole text pages, use "txt_get_act" and
  4173.        "txt_get_vis".
  4174.  
  4175. Return Value: = offset of text page
  4176.  
  4177. See Also: txt_get_act txt_set_abs
  4178.  
  4179. --------------------------------------------------------------------------------
  4180.                                                                             TEXT
  4181. byte txt_get_act(void);
  4182. Function: Return the current active text video page.
  4183.  
  4184. byte txt_get_vis(void);
  4185. Function: Return the current visual text video page.
  4186.  
  4187. Notes: The pages are number from TEXTPAGE1 to TEXTPAGE8 for 25 line text modes
  4188.        and from TEXTPAGE1 to TEXTPAGE4 for 50 line text modes.
  4189.  
  4190. Return Value: = txt_get_act - current active text page
  4191.               = txt_get_vis - current visual text page
  4192.  
  4193. See Also: txt_get_abs txt_set_act
  4194.  
  4195. --------------------------------------------------------------------------------
  4196.                                                                             TEXT
  4197. byte txt_last(void);
  4198. Function: Return last text page.
  4199.  
  4200. Return Value: = last text video page number (starting from 0)
  4201.  
  4202. See Also: txt_rows
  4203.  
  4204. --------------------------------------------------------------------------------
  4205.                                                                             TEXT
  4206. void txt_mem(byte what, textimagedata *timage);
  4207. Function: Store or restore the text video memory.
  4208.  
  4209. Arguments: = "what"
  4210.              - TEXTSHOW  restores the text video memory into "timage"
  4211.              - TEXTSAVE  stores the text video memory into "timage"
  4212.        = the storage area "timage" is used
  4213.              - if "timage" = NULL, the one built-in storage area is used
  4214.  
  4215. Notes: The built-in storage area will hold the contents of an entire 80x50
  4216.        screen.  The memory requirements of "timage" are returned by the function
  4217.        "txt_chrattrs_need(80, height)", using the desired screen "height". This
  4218.        function is useful for restoring the screen contents after exitting a
  4219.        program to give the user the feel he never left DOS.  See Global Type
  4220.        Definitions for a description of the structure "textimagedata".
  4221.  
  4222. See Also: _video_set
  4223.  
  4224. --------------------------------------------------------------------------------
  4225.                                                                             TEXT
  4226. word txt_print(byte x, byte y, printdata *prdata);
  4227. Function: Print the string "prdata.string" to the text screen.
  4228.  
  4229. Arguments: = the information in the "printdata" structure "prdata" is used
  4230.            = the printing begins at the corner "x","y"
  4231.              - if "x" = MEM, "prdata.x" is used
  4232.              - if "y" = MEM, "prdata.y" is used
  4233.  
  4234. Notes: If "prdata.x" and "prdata.y" (or "x" and "y") both equal TCUR,
  4235.        "txt_print" advances the text cursor position to one past the last
  4236.        character printed.
  4237.  
  4238. Return Value: = length of "prdata.string"
  4239.  
  4240. See Also: txt_fill_area txt_attr_show txt_attrs_show txt_chr_show
  4241.           txt_str_show txt_strattr_show txt_str_erase_pr
  4242.  
  4243. --------------------------------------------------------------------------------
  4244.                                                                             TEXT
  4245. byte txt_rows(void);
  4246. Function: Return the [number of rows per page]-1.
  4247.  
  4248. Notes: To set the number of rows per page, use "video_set".
  4249.  
  4250. Return Value: = [number of rows per page]-1
  4251.  
  4252. See Also: txt_last video_set
  4253.  
  4254. --------------------------------------------------------------------------------
  4255.                                                                             TEXT
  4256. void txt_scroll(int columns, int rows);
  4257. Function: Smoothly scroll, in any direction, the entire screen.
  4258.  
  4259. void txt_scroll_fast(shortint columns, shortint rows);
  4260. Function: Quickly smoothly scroll, in any direction, the entire screen.
  4261.  
  4262. Arguments: = smoothly scrolls the entire screen "columns" columns and "rows"
  4263.              rows
  4264.  
  4265. Notes: The reason "txt_scroll" is faster is because it does not properly
  4266.        align itself with the monitor's vertical retrace periods -- this
  4267.        translates to possible flicker.  Positive "columns" scrolls right whereas
  4268.        negative scrolls left.  Positive "rows" scrolls down whereas negative
  4269.        scrolls up.
  4270.  
  4271. See Also: txt_scroll_off txt_scroll_over txt_scroll_rows txt_scroll_window
  4272.           txt_split
  4273.  
  4274. --------------------------------------------------------------------------------
  4275.                                                                             TEXT
  4276. void txt_scroll_off(shortint direction);
  4277. Function: Smoothly scroll the screen off in a direction.
  4278.  
  4279. void txt_scroll_on(shortint direction);
  4280. Function: Smoothly scroll a screen on in a direction.
  4281.  
  4282. Arguments: = scrolls the screen in direction "direction"
  4283.              - UP    - scrolls screen up
  4284.              - LEFT  - scrolls screen left
  4285.              - RIGHT - scrolls screen right
  4286.              - DOWN  - scrolls screen down
  4287.  
  4288. Notes: This is a nice effect for entering and exiting programs.
  4289.  
  4290. See Also: txt_scroll
  4291.  
  4292. Example Program: None.
  4293.  
  4294. --------------------------------------------------------------------------------
  4295.                                                                             TEXT
  4296. void txt_scroll_over(int scanlines);
  4297. Function: Smoothly scroll a screen overtop another screen.
  4298.  
  4299. Arguments: = if "scanlines" is negative, scrolls screen down
  4300.              - use negative values to scroll a screen off that was scrolled on
  4301.  
  4302. Notes: This is a nice effect for, perhaps, pulling up a help screen.
  4303.  
  4304. See Also: txt_scroll
  4305.  
  4306. Example Program: None.
  4307.  
  4308. --------------------------------------------------------------------------------
  4309.                                                                             TEXT
  4310. void txt_scroll_rows(byte row, byte height, shortint horz_scroll);
  4311. Function: Smoothly scroll certain rows.
  4312.  
  4313. Arguments: = scrolls the screen region beginning at row "row" with height
  4314.              "height" "horz_scroll" columns
  4315.  
  4316. Notes: This differs from "txt_scroll" in that only a portion of the screen is
  4317.        scrolled, not the entire screen.
  4318.  
  4319. See Also: txt_scroll
  4320.  
  4321. Example Program: None.
  4322.  
  4323. --------------------------------------------------------------------------------
  4324.                                                                             TEXT
  4325. void txt_scroll_window(byte x, byte y, byte length, byte height,
  4326.                        shortint horz_scroll, shortint vert_scroll);
  4327. Function: Smoothly scroll, in any direction, a window of the screen.
  4328.  
  4329. Arguments: = scrolls the screen region with a corner at "x","y", an x-length
  4330.              "length", and a y-height "height" "horz_scroll" characters and
  4331.              "vert_scroll" rows
  4332.  
  4333. Notes: Positive "horz_scroll" scrolls right whereas negative scrolls left.
  4334.        Positive "vert_scroll" scrolls down whereas negative scrolls up.
  4335.  
  4336. See Also: txt_scroll txt_split
  4337.  
  4338. --------------------------------------------------------------------------------
  4339.                                                                             TEXT
  4340. void txt_set_abs(word offset);
  4341. Function: Set the absolute offset of the text page.
  4342.  
  4343. void txt_set_rel(int columns, int rows);
  4344. Function: Set the absolute offset of the text page.
  4345.  
  4346. Arguments: = txt_set_abs - sets offset of text page to "offset"
  4347.            = txt_set_rel - sets horizontal offset "columns" and vertical offset
  4348.                            "rows" from original offset
  4349.  
  4350. Notes: The mouse cursor and text cursor position and shape are not preserved as
  4351.        they are by "txt_set_act" and "txt_set_vis" -- when strictly dealing with
  4352.        whole text pages, use "txt_set_act" and "txt_set_vis".
  4353.  
  4354. See Also: txt_get_abs txt_set_act
  4355.  
  4356. --------------------------------------------------------------------------------
  4357.                                                                             TEXT
  4358. void txt_set_act(byte page);
  4359. Function: Set a text video page as active.
  4360.  
  4361. void txt_set_vis(byte page);
  4362. Function: Set a text video page as visual, or seen.
  4363.  
  4364. Arguments: = txt_set_act - the active text page "page" is set
  4365.                            - if "page" = TEXTPAGEVISUAL, the active text page
  4366.                              becomes the current visual text page
  4367.                            - if "page" = TEXTPAGELAST, the last page becomes the
  4368.                              active text page
  4369.            = txt_set_vis - the visual text page "page" is set
  4370.                            - if "page" = TEXTPAGEACTIVE, the visual text page
  4371.                              becomes the current active text page
  4372.                            - if "page" = TEXTPAGELAST, the last page becomes the
  4373.                              visual text page
  4374.  
  4375. Notes: The pages are number from TEXTPAGE1 to TEXTPAGE8 for 25 line text modes
  4376.        and from TEXTPAGE1 to TEXTPAGE4 for 50 line text modes.
  4377.  
  4378. See Also: txt_get_act txt_set_abs
  4379.  
  4380. --------------------------------------------------------------------------------
  4381.                                                                             TEXT
  4382. void txt_split(word line);
  4383. Function: Split the visual screen into two.
  4384.  
  4385. Arguments: = the visual page is split at line "line"
  4386.  
  4387. Notes: In VGA, the lines range from 0-400 and each character is 16 lines high.
  4388.        To break off at an even number of rows, use this formula: (row*16) - 1
  4389.        (ie. to split the screen at row 3, use the value 47 for "line").  It is
  4390.        possible to display TWO blinking cursors this way.
  4391.  
  4392. See Also: txt_scroll txt_scroll_window
  4393.  
  4394. ================================================================================
  4395. ---------------------------------  ANIMATION  ----------------------------------
  4396.  
  4397.  
  4398. ================================================================================
  4399. ---------------------------------  ATTRIBUTE  ----------------------------------
  4400.  
  4401. char txt_attr_save(byte x, byte y, byte *fgclr, byte *bgclr);
  4402. Function: Read one attribute.
  4403.  
  4404. Arguments: = stores the foreground color at "x","y" into "fgclr" and the
  4405.              background color into "bgclr"
  4406.              - if "fgclr" = NULL, the foreground color is not stored
  4407.              - if "bgclr" = NULL, the background color is not stored
  4408.  
  4409. Return Value: = ASCII value of the character at "x","y"
  4410.  
  4411. See Also: txt_attr_show txt_attrs_save txt_chr_attr_save txt_chrattr_save
  4412.  
  4413. --------------------------------------------------------------------------------
  4414.                                                                        ATTRIBUTE
  4415. char txt_attr_show(byte x, byte y, byte fgclr, byte bgclr, int count);
  4416. Function: Print a specific number of one attribute.
  4417.  
  4418. Arguments: = prints the foreground color "fgclr" and the background color
  4419.              "bgclr" at "x","y"
  4420.              - if "fgclr" = NO, the foreground is not modified
  4421.              - if "bgclr" = NO, the background is not modified
  4422.  
  4423. Notes: If "x" and "y" both equal TCUR, "txt_attr_show" advances the text
  4424.        cursor position to one past the last attribute printed.
  4425.  
  4426. Return Value: = ASCII value of the character at "x","y"
  4427.  
  4428. See Also: txt_attr_save txt_attrs_show txt_bg_get txt_chr_show txt_fg_get
  4429.  
  4430. --------------------------------------------------------------------------------
  4431.                                                                        ATTRIBUTE
  4432. void txt_attrs_fill(byte x, byte y,
  4433.                      byte length, byte height, byte fgclr, byte bgclr);
  4434. Function: Fill a screen region with a foreground and/or background color.
  4435.  
  4436. Arguments: = the region with a corner at "x","y", an x-length "length", and a
  4437.              y-height "height" is filled in foreground "fgclr" and background
  4438.              "bgclr"
  4439.              - if "fgclr" = NO, the foreground is not modified
  4440.              - if "bgclr" = NO, the background is not modified
  4441.  
  4442. See Also: txt_fill_area
  4443.  
  4444. --------------------------------------------------------------------------------
  4445.                                                                        ATTRIBUTE
  4446. word txt_attrs_need(byte length, byte height);
  4447. Function: Return the memory requirement for a "txt_attrs_save"ed image.
  4448.  
  4449. word txt_chrattrs_need(byte length, byte height);
  4450. Function: Return the memory requirement for a "txt_chrattrs_save"ed image.
  4451.  
  4452. word txt_chrs_need(byte length, byte height);
  4453. Function: Return the memory requirement for a "txt_chrs_save"ed image.
  4454.  
  4455. word txt_strattr_need(byte length, byte height);
  4456. Function: Return the memory requirement for a "txt_strattr_save"ed image.
  4457.  
  4458. Arguments: = the memory requirement for a region of x-length "length" and
  4459.              y-height "height" is calculated
  4460.  
  4461. Return Value: = memory requirement in bytes
  4462.  
  4463. See Also: txt_attrs_save txt_chrattrs_save txt_chrs_save txt_strattr_save
  4464.  
  4465. --------------------------------------------------------------------------------
  4466.                                                                        ATTRIBUTE
  4467. void txt_attrs_save(byte x, y,
  4468.                      byte length, byte height, textimagedata *attrs);
  4469. Function: Read a region of attributes.
  4470.  
  4471. Arguments: = stores the region of attributes from the corner "x","y" with
  4472.              x-length "length" and y-height "height" into "attrs"
  4473.              - if "x" = MEM,  "attrs.x" is used
  4474.              - if "y" = MEM,  "attrs.y" is used
  4475.              - if "length" = MEM, "attrs.length" is used
  4476.              - if "height" = MEM, "attrs.height" is used
  4477.  
  4478. Notes: Make sure enough memory has been allocated to "attrs" by a call to
  4479.        "txt_attrs_need".  If a "length" and/or "height" is given, it is
  4480.        stored in "attrs.length" and/or "attrs.height", respectively.  See
  4481.        Global Type Definitions for a description of the structure
  4482.        "textimagedata".
  4483.  
  4484. See Also: txt_attrs_need txt_attr_save txt_attrs_show txt_str_save
  4485.  
  4486. --------------------------------------------------------------------------------
  4487.                                                                        ATTRIBUTE
  4488. void txt_attrs_show(byte x, byte y,
  4489.                      byte fgclr, byte bgclr, textimagedata *attrs);
  4490. Function: Print a region of attributes.
  4491.  
  4492. Arguments: = prints the region of attributes, stored in "attrs", with top-left
  4493.              corner "x","y"
  4494.              - if "x" = MEM,  "attrs.x" is used
  4495.              - if "y" = MEM,  "attrs.y" is used
  4496.            = if "fgclr" = NO,  the foreground is not modified
  4497.                         = YES, modifies the foreground with the stored colors
  4498.                         = MEM, "attrs.fgclr" is used
  4499.            = if "bgclr" = NO, the background is not modified
  4500.                         = YES, modifies the background with the stored colors
  4501.                         = MEM, "attrs.bgclr" is used
  4502. Notes: See Global Type Definitions for a description of the structure
  4503.        "textimagedata".
  4504.  
  4505. See Also: txt_print txt_attr_show txt_str_show txt_attrs_save
  4506.  
  4507. --------------------------------------------------------------------------------
  4508.                                                                        ATTRIBUTE
  4509. byte txt_bg_get(byte x, byte y);
  4510. Function: Return the background color at specified coordinates.
  4511.  
  4512. Arguments: = background color is read from "x","y"
  4513.  
  4514. Return Value: = background color at "x","y"
  4515.  
  4516. See Also: txt_attr_save txt_fg_get
  4517.  
  4518. --------------------------------------------------------------------------------
  4519.                                                                        ATTRIBUTE
  4520. byte txt_fg_get(byte x, byte y);
  4521. Function: Return the foreground color at specified coordinates.
  4522.  
  4523. Arguments: = foreground color is read from "x","y"
  4524.  
  4525. Return Value: = foreground color at "x","y"
  4526.  
  4527. See Also: txt_attr_save txt_bg_get
  4528.  
  4529. ================================================================================
  4530. ---------------------------------  CHARACTER  ----------------------------------
  4531.  
  4532. void txt_chr_attr_save(byte x, byte y, byte *fgclr, byte *bgclr, char *ch);
  4533. Function: Save one character and its attribute.
  4534.  
  4535. Arguments: = character "ch" at "x","y", with its background color "bgclr" and
  4536.              foreground color "fgclr", are saved
  4537.              - if "fgclr" = NULL, the foreground color is not stored
  4538.              - if "bgclr" = NULL, the background color is not stored
  4539.              - if "ch" = NULL, the character is not stored
  4540.  
  4541. Notes: If "x" and "y" both equal TCUR, "txt_chr_attr_show" advances the text
  4542.        cursor position to one past the last character printed.
  4543.  
  4544. See Also: txt_attr_save txt_chr_attr_show txt_chrattr_save
  4545.  
  4546. --------------------------------------------------------------------------------
  4547.                                                                        CHARACTER
  4548. char txt_chr_attr_show(byte x, byte y,
  4549.                        byte fgclr, byte bgclr, char ch, int count);
  4550. Function: Print a specific number of one character in a defined color.
  4551.  
  4552. Arguments: = "count" characters "ch" are printed in foreground color "fgclr"
  4553.              and background color "bgclr" at "x","y"
  4554.              - if "fgclr" = NO, the foreground is not modified
  4555.              - if "bgclr" = NO, the background is not modified
  4556.  
  4557. Notes: If "x" and "y" both equal TCUR, "txt_chr_attr_show" advances the text
  4558.        cursor position to one past the last character printed.
  4559.  
  4560. Return Value: = ASCII value of first character overwritten
  4561.  
  4562. See Also: txt_chr_attr_save txt_chrattr_show txt_fillcol _txt_fillrow
  4563.           txt_str_attr_show
  4564.  
  4565. --------------------------------------------------------------------------------
  4566.                                                                        CHARACTER
  4567. char txt_chr_erase(byte x, byte y, int count);
  4568. Function: Overwrite a specific number of characters with spaces.
  4569.  
  4570. Arguments: = overwrites "count" characters at "x","y" with spaces (ASCII 32)
  4571.  
  4572. Return Value: = ASCII value of first character overwritten
  4573.  
  4574. See Also: txt_chr_show txt_chrattr_show txt_chrattrs_show txt_chrs_erase
  4575.           txt_erase
  4576.                       
  4577. --------------------------------------------------------------------------------
  4578.                                                                        CHARACTER
  4579. char txt_chr_get(byte x, byte y);
  4580. Function: Read one character.
  4581.  
  4582. Arguments: = returns the character at "x","y"
  4583.  
  4584. Return Value: = ASCII value of character
  4585.  
  4586. See Also: txt_chr_show txt_chrattr_save txt_chrs_save
  4587.  
  4588. --------------------------------------------------------------------------------
  4589.                                                                        CHARACTER
  4590. char txt_chr_show(byte x, byte y, char ch, int count);
  4591. Function: Print a specific number of one character.
  4592.  
  4593. Arguments: = prints "count" characters "ch" at "x","y"
  4594.  
  4595. Notes: If "x" and "y" both equal TCUR, "txt_chr_show" advances the text
  4596.        cursor position to one past the last character printed.
  4597.  
  4598. Return Value: = ASCII value of first character overwritten
  4599.  
  4600. See Also: txt_attr_show txt_chr_erase txt_chr_get txt_chrattr_show
  4601.           txt_chrs_show txt_str_show
  4602.  
  4603. --------------------------------------------------------------------------------
  4604.                                                                        CHARACTER
  4605. char txt_chrattr_save(byte x, byte y, word *chrattr);
  4606. Function: Store a character with its attribute.
  4607.  
  4608. Arguments: = the character and its attribute are read from "x","y" and are
  4609.              stored in "chrattr"
  4610.  
  4611. Return Value: = ASCII value of character that was saved
  4612.  
  4613. See Also: txt_attr_save txt_chr_attr_save txt_chr_get txt_chrattr_show
  4614.  
  4615. --------------------------------------------------------------------------------
  4616.                                                                        CHARACTER
  4617. char txt_chrattr_show(byte x, byte y,
  4618.                       byte fgclr, byte bgclr, word chrattr, int count);
  4619. Function: Print a specific number of one character with its attribute.
  4620.  
  4621. Arguments: = "count" characters and attributes, stored in "chrattr", are
  4622.              printed at "x","y"
  4623.            = if "fgclr" = NO, the foreground is not modified
  4624.            = if "bgclr" = NO, the background is not modified
  4625.  
  4626. Notes: If "x" and "y" both equal TCUR, "txt_chr_show" advances the text
  4627.        cursor position to one past the last character printed.  Use
  4628.        "txt_chr_erase" to erase "txt_chrattr_show"ed characters.
  4629.  
  4630. Return Value: = ASCII value of first character overwritten
  4631.  
  4632. See Also: txt_chr_attr_show txt_chr_erase txt_chrattr_save
  4633.           txt_chr_show
  4634.  
  4635.  
  4636. --------------------------------------------------------------------------------
  4637.                                                                        CHARACTER
  4638. char txt_chrattrs_fill(byte x, byte y, byte length, byte height,
  4639.                         byte fgclr, byte bgclr, char ch);
  4640. Function: Fill a screen region with a foreground and/or background color and a
  4641.           character.
  4642.  
  4643. Arguments: = the region with a corner at "x","y", an x-length "length", and a
  4644.              y-height "height" is filled in foreground "fgclr", background
  4645.              "bgclr", and character "ch"
  4646.              - if "fgclr" = NO, the foreground is not modified
  4647.              - if "bgclr" = NO, the background is not modified
  4648.              - if "ch" = NO, no character is written
  4649.  
  4650. Return Value: = ASCII value of first character overwritten
  4651.  
  4652. See Also: txt_fill_area
  4653.  
  4654. --------------------------------------------------------------------------------
  4655.                                                                        CHARACTER
  4656. word txt_chrattrs_need(byte length, byte height);
  4657.  
  4658. [see txt_attrs_need]
  4659.  
  4660. --------------------------------------------------------------------------------
  4661.                                                                        CHARACTER
  4662. void txt_chrattrs_save(byte x, byte y,
  4663.                         byte length, byte height, textimagedata *chrattrs);
  4664. Function: Read a region with its attributes from the text screen.
  4665.  
  4666. Arguments: = stores the region of characters and their attributes from the
  4667.              corner "x","y" with x-length "length" and y-height "height" into
  4668.              "chrattrs"
  4669.              - if "x" = MEM, "chrattrs.y" is used
  4670.              - if "y" = MEM, "chrattrs.x" is used
  4671.              - if "length" = MEM, "chrattrs.length" is used
  4672.              - if "height" = MEM, "chrattrs.height" is used
  4673.  
  4674. Notes: Make sure enough memory has been allocated to "chrattrs" by a call to
  4675.        "txt_chrattrs_need".  If a "length" and/or "height" is given, it is
  4676.        stored in "chrattrs.length" and/or "chrattrs.height", respectively.
  4677.        See Global Type Definitions for a description of the structure
  4678.        "textimagedata".
  4679.  
  4680. See Also: txt_chrattrs_need txt_chrattrs_show
  4681.  
  4682. --------------------------------------------------------------------------------
  4683.                                                                        CHARACTER
  4684. void txt_chrattrs_show(byte x, byte y,
  4685.                        byte fgclr, byte bgclr, textimagedata *chrattrs);
  4686. Function: Print a region with its attributes to the text screen.
  4687.  
  4688. void txt_chrattrs_show_char(byte x, byte y, byte x_timage, byte y_timage,
  4689.                             byte fgclr, byte bgclr, textimagedata *chrattrs);
  4690. Function: Print only one character from a region with its attributes to the text
  4691.           screen.
  4692.  
  4693. void txt_chrattrs_show_str(byte x, byte y, byte x_timage, byte y_timage,
  4694.                  byte length,  byte fgclr, byte bgclr, textimagedata *chrattrs);
  4695. Function: Print only a string of character from a region with its attributes to
  4696.           the text screen.
  4697.  
  4698. void txt_chrattrs_show_region(byte x, byte y, byte x_timage, byte y_timage,
  4699.      byte length, byte height, byte fgclr, byte bgclr, textimagedata *chrattrs);
  4700. Function: Print only a region from a region with its attributes to the text
  4701.           screen.
  4702.  
  4703. Arguments: = prints from a region of characters and their attributes, stored in
  4704.              "chrattrs", with top-left corner at "x","y"
  4705.              - if "x" = MEM, "chrattrs.y" is used
  4706.              - if "y" = MEM, "chrattrs.x" is used
  4707.            = if "fgclr" = NO,  the foreground is not modified
  4708.                         = YES, modifies the foreground with the stored colors
  4709.                         = MEM, "chrattrs.fgclr" is used
  4710.            = if "bgclr" = NO, the background is not modified
  4711.                         = YES, modifies the background with the stored colors
  4712.                         = MEM, "chrattrs.bgclr" is used
  4713.            = txt_chrattrs_show_char   - start from "x_timage","y_timage", inside
  4714.                                         the saved region
  4715.            = txt_chrattrs_show_str    - start from "x_timage","y_timage", inside
  4716.                                         the saved region
  4717.                                       - go for length "length"
  4718.            = txt_chrattrs_show_region - start from "x_timage","y_timage", inside
  4719.                                         the saved region
  4720.                                       - go for length "length" and height
  4721.                                         "height"
  4722.  
  4723. Notes: Use "txt_chrs_erase" to erase a "txt_chrattrs_show"ed region.  See
  4724.        Global Type Definitions for a description of the structure
  4725.        "textimagedata".
  4726.  
  4727. Return Value: Use "txt_chrs_erase" to erase a "txt_chrs_show"ed character.
  4728.  
  4729. See Also: txt_chr_show txt_chrs_erase txt_chrattrs_save
  4730.  
  4731. --------------------------------------------------------------------------------
  4732.                                                                        CHARACTER
  4733. void txt_chrs_erase(byte x, byte y, textimagedata *chrs);
  4734. Function: Overwrite a "textimagedata"ed image with spaces.
  4735.  
  4736. Arguments: = overwrites "chrs" with corner at "x","y" with spaces (ASCII 32)
  4737.              - if "x" = MEM, "chrs.y" is used
  4738.              - if "y" = MEM, "chrs.x" is used
  4739.  
  4740. Notes: See Global Type Definitions for a description of the structure
  4741.        "textimagedata".
  4742.  
  4743. See Also: txt_chr_erase txt_chrattrs_show txt_chrs_show txt_erase
  4744.           txt_str_erase txt_strattr_show
  4745.  
  4746. --------------------------------------------------------------------------------
  4747.                                                                        CHARACTER
  4748. void txt_chrs_fill(byte x, byte y, byte length, byte height, char ch);
  4749. Function: Fill a screen region with a character.
  4750.  
  4751. Arguments: = the region with a corner at "x","y", an x-length "length", and a
  4752.              y-height "height" is filled in with character "ch"
  4753.  
  4754. See Also: txt_fill_area
  4755.  
  4756. --------------------------------------------------------------------------------
  4757.                                                                        CHARACTER
  4758. word txt_chrs_need(byte length, byte height);
  4759.  
  4760. [see txt_attrs_need]
  4761.  
  4762. --------------------------------------------------------------------------------
  4763.                                                                        CHARACTER
  4764. void txt_chrs_save(byte x, byte y,
  4765.                     byte length, byte height, textimagedata *chrs);
  4766. Function: Read a region of characters from the text screen.
  4767.  
  4768. Arguments: = stores the region of characters from the corner "x","y" with
  4769.              x-length "length" and y-height "height" into "chrs"
  4770.              - if "x" = MEM, "chrs.y" is used
  4771.              - if "y" = MEM, "chrs.x" is used
  4772.              - if "length" = MEM, "chrs.length" is used
  4773.              - if "height" = MEM, "chrs.height" is used
  4774.  
  4775. Notes: Make sure enough memory has been allocated to "chrs" by a call to
  4776.        "txt_chrs_need".  See Global Type Definitions for a description of the
  4777.        structure "textimagedata".
  4778.  
  4779. See Also: txt_chr_get txt_chrs_need txt_chrs_show
  4780.  
  4781. --------------------------------------------------------------------------------
  4782.                                                                        CHARACTER
  4783. void txt_chrs_show(byte x, byte y, textimagedata *chrs);
  4784. Function: Print a region of characters to the text screen.
  4785.  
  4786. Arguments: = shows the region of characters, stored in "chrs", with top-left
  4787.              corner at "x","y"
  4788.              - if "x" = MEM, "chrs.y" is used
  4789.              - if "y" = MEM, "chrs.x" is used
  4790.  
  4791. Notes: See Global Type Definitions for a description of the structure
  4792.        "textimagedata".
  4793.  
  4794. See Also: txt_chr_show txt_chrs_erase txt_chrs_save
  4795.  
  4796. ================================================================================
  4797. ----------------------------------  CURSOR  ------------------------------------
  4798.  
  4799. void cur_get(cursordata *curdata);
  4800. Function: Store all cursor information on the active page.
  4801.  
  4802. void cur_get_abs(cursordata *curdata);
  4803. Function: Store all cursor information on the active page as reported by the
  4804.           VGA card.
  4805.  
  4806. Arguments: = cur_get     - stores cursor information into "curdata"
  4807.              cur_get_abs
  4808.  
  4809. Notes: "cur_get_abs" can be used before the call to "bestlib_init" because it
  4810.        does not rely on the internal variables set by "bestlib_init" (it reads
  4811.        the VGA registers directly).
  4812.  
  4813. See Also: cur_get_coord cur_get_shape cur_set ms_get
  4814.  
  4815. --------------------------------------------------------------------------------
  4816.                                                                           CURSOR
  4817. void cur_get_coord(byte *x, byte *y);
  4818. Function: Store the cursor location on the active page.
  4819.  
  4820. void cur_get_coord_abs(byte *x, byte *y);
  4821. Function: Store the cursor location on the active page as reported by the VGA
  4822.           card.
  4823.  
  4824. byte cur_get_x(void);
  4825. Function: Return the cursor abscissa on the active page.
  4826.  
  4827. byte cur_get_x_abs(void);
  4828. Function: Return the cursor abscissa on the active page as reported by the VGA
  4829.           card.
  4830.  
  4831. byte cur_get_y(void);
  4832. Function: Return the cursor ordinate on the active page.
  4833.  
  4834. byte cur_get_y_abs(void);
  4835. Function: Return the cursor ordinate on the active page as reported by the VGA
  4836.           card.
  4837.  
  4838. Arguments: = cur_get_coord     - stores cursor abscissa into "x" and ordinate
  4839.              cur_get_coord_abs   into "y"
  4840.                                - if "y" is NULL, "x" is assumed to be
  4841.                                  "byte *xy", a data structure that has "x" and
  4842.                                  "y" as consecutive bytes
  4843.  
  4844. Notes: The "_abs" forms of the get cursor functions can be used before the
  4845.        call to "bestlib_init" because they do not rely on the internal
  4846.        variables set by "bestlib_init" (they read the VGA registers directly).
  4847.  
  4848. Return Value: = cur_get_x     - abscissa of cursor on active page
  4849.               = cur_get_x_abs - abscissa of cursor as reported by VGA card
  4850.               = cur_get_y     - ordinate of cursor on active page
  4851.               = cur_get_y_abs - ordinate of cursor as reported by VGA card
  4852.  
  4853. See Also: cur_get cur_get_shape ms_get
  4854.  
  4855. --------------------------------------------------------------------------------
  4856.                                                                           CURSOR
  4857. void cur_get_shape(byte *start, byte *end);
  4858. Function: Store the text cursor's shape on the active page.
  4859.  
  4860. void cur_get_shape_abs(byte *start, byte *end);
  4861. Function: Store the text cursor's shape as reported by the VGA card.
  4862.  
  4863. Arguments: = cur_get_shape      - the starting scan line of the cursor is
  4864.              cur_get_shape_abs    stored in "start" and the ending scan line
  4865.                                   is stored in "end"
  4866.                                 - if "end" = NULL, "start" is assumed to be
  4867.                                   "byte *start_end", a data structure that has
  4868.                                   "start" and "end" as consecutive bytes
  4869.  
  4870. See Also: cur_get cur_set_shape
  4871.  
  4872. --------------------------------------------------------------------------------
  4873.                                                                           CURSOR
  4874. boolean cur_is_on(void);
  4875. Function: Check if the cursor is on.
  4876.  
  4877. Return Value: = TRUE if cursor is on
  4878.               = FALSE if it is not
  4879.  
  4880. See Also: cur_off
  4881.  
  4882. --------------------------------------------------------------------------------
  4883.                                                                           CURSOR
  4884. void cur_off(void);
  4885. Function: Turn the cursor off.
  4886.  
  4887. void cur_on(void);
  4888. Function: Turn the cursor on.
  4889.  
  4890. See Also: cur_is_on
  4891.  
  4892. --------------------------------------------------------------------------------
  4893.                                                                           CURSOR
  4894. void cur_set(cursordata *curdata);
  4895. Function: Set all the cursor's statistics on the active text page.
  4896.  
  4897. void cur_set_bios(cursordata *curdata);
  4898. Function: Set all the cursor's statistics via the BIOS on the active text page.
  4899.  
  4900. Arguments: = cur_set      - the cursor's statistics are read from the
  4901.              cur_set_bios   structure "curdata"
  4902.  
  4903. See Also: cur_set_coord cur_set_shape cur_get ms_set
  4904.  
  4905. --------------------------------------------------------------------------------
  4906.                                                                           CURSOR
  4907. byte cur_set_coord(byte x, byte y);
  4908. Function: Set the cursor abscissa and ordinate on the active text page.
  4909.  
  4910. void cur_set_coord_bios(byte x, byte y);
  4911. Function: Set the cursor abscissa and ordinate via the BIOS on the active text
  4912.           page.
  4913.  
  4914. byte cur_set_x(byte x);
  4915. Function: Set the cursor abscissa on the active text page.
  4916.  
  4917. byte cur_set_x_bios(byte x);
  4918. Function: Set the cursor abscissa on the active text page via BIOS.
  4919.  
  4920. byte cur_set_y(byte y);
  4921. Function: Set the cursor ordinate on the active text page.
  4922.  
  4923. byte cur_set_y_bios(byte y);
  4924. Function: Set the cursor ordinate on the active text page via BIOS.
  4925.  
  4926. Arguments: = cur_set_coord      - the cursor's new position is at "x","y"
  4927.              cur_set_coord_bios
  4928.            = cur_set_x           - the cursor's new abscissa is at "x"
  4929.              cur_set_x_bios
  4930.            = cur_set_y           - the cursor's new ordinate is at "y"
  4931.              cur_set_y_bios
  4932.  
  4933. Return Value: = cur_set_x      - the cursor ordinate
  4934.                 cur_set_x_bios
  4935.               = cur_set_coord - the cursor abscissa
  4936.                 cur_set_y
  4937.                 set_sety_bios
  4938.  
  4939. See Also: cur_get cur_set ms_set
  4940.  
  4941. --------------------------------------------------------------------------------
  4942.                                                                           CURSOR
  4943. void cur_set_shape(byte start, byte end);
  4944. Function: Define a new cursor shape
  4945.  
  4946. void cur_set_shape_bios(byte start, byte end);
  4947. Function: Define a new cursor shape on the active text page via the BIOS.
  4948.  
  4949. Arguments: = cur_set_shape      - the starting scan line of the cursor is set
  4950.              cur_set_shape_bios   to "start" and the ending scan line is set
  4951.                                   to "end"
  4952.                                 - if "start" = NO, the starting scan line of
  4953.                                   the cursor is not modified
  4954.                                 - if "end" = NO, the ending scan line of the
  4955.                                   cursor is not modified
  4956.  
  4957. Notes: "start" and "end" must be between 0 - 31.
  4958.  
  4959. See Also: cur_get_shape cur_set
  4960.  
  4961. ================================================================================
  4962. ------------------------------------  GET  -------------------------------------
  4963.  
  4964. int txt_get_let(byte x, byte y, char *str, byte max, byte fillchar,
  4965.                 char *msg, byte fgclr, byte bgclr, char *def);
  4966. Function: Get alphabet input from the keyboard.
  4967.  
  4968. int txt_get_num(byte x, byte y, int *input, byte max, byte fillchar,
  4969.                 char *msg, byte fgclr, byte bgclr, char *def);
  4970. Function: Get numeric input from the keyboard.
  4971.  
  4972. int txt_get_numu(byte x, byte y, word *input, byte max, byte fillchar,
  4973.                  char *msg, byte fgclr, byte bgclr, char *def);
  4974. Function: Get unsigned numeric input from the keyboard.
  4975.  
  4976. STILL UNDER DEVELOPMENT
  4977. int txt_get_numl(byte x, byte y, long int *input, byte max, byte fillchar,
  4978.                  char *msg, byte fgclr, byte bgclr, char *def);
  4979. Function: Get long numeric input from the keyboard.
  4980.  
  4981. STILL UNDER DEVELOPMENT
  4982. int txt_get_numlu(byte x, byte y, unsigned long int *input, byte max,
  4983.                   byte fillchar, char *msg, byte fgclr, byte bgclr, char *def);
  4984. Function: Get unsigned long numeric input from the keyboard.
  4985.  
  4986. int txt_get_str(byte x, byte y, char *str, byte max, byte fillchar,
  4987.                 char *msg, byte fgclr, byte bgclr, char *def);
  4988. Function: Get string input from the keyboard.
  4989.  
  4990. Arguments: = prints the message "msg" at "x","y" followed by the default
  4991.              response "def" and waits for user input
  4992.            = fills the empty response space with character "fillchar"
  4993.              - if "fillchar" = NO, the response space is not filled with a
  4994.                                character
  4995.        = colors the response space with foreground "fgclr" and background
  4996.          "bgclr"
  4997.              - if "fgclr"  = NO, the foreground color is not modified
  4998.              - if "bgclr"  = NO, the background color is not modified
  4999.            = txt_get_let   - stores user input in "str"
  5000.                            - allows only alphabet letters to be inputed
  5001.                            - accepts a maximum of "max" characters
  5002.                            - if "max" = MAX, accepts a maximum of
  5003.                              "str_len(str)" characters
  5004.            = txt_get_str   - stores user input in "str"
  5005.                            - allows all ASCII characters to be inputed
  5006.                            - accepts a maximum of "max" characters
  5007.                            - if "max" = MAX, accepts a maximum of
  5008.                              "str_len(str)" characters
  5009.            = txt_get_num   - stores the numerical value of user input in
  5010.                              "input"
  5011.                            - accepts a maximum number of "max" digits
  5012.                              - input is allowed between -32768..32767
  5013.                            - allows a maximum of 6 characters or the number of
  5014.                              digits "max"
  5015.            = txt_get_numu  - stores the numerical value of user input in
  5016.                             "input"
  5017.                            - accepts a maximum number of "max" digits
  5018.                              - input is allowed between 0..65535
  5019.                            - allows a maximum of 5 characters or the number of
  5020.                              digits "max"
  5021.            = txt_get_numl  - stores the numerical value of user input in
  5022.                             "input"
  5023.                            - accepts a maximum number of "max" digits
  5024.                              - input is between -2 147 483 648..2 147 483 647
  5025.                            - allows a maximum of 11 characters or the number of
  5026.                              digits "max"
  5027.            = txt_get_numlu - stores the numerical value of user input in
  5028.                              "input"
  5029.                            - accepts a maximum number of "max" digits
  5030.                              - input is allowed between 0..4 294 967 295
  5031.                            - allows a maximum of 10 characters or the number of
  5032.                              digits max"
  5033.  
  5034. Notes: These functions will not wrap around the screen; the cursor will not go
  5035.        beyond the right screen boundary.  They return upon the user pressing
  5036.        <ENTER> or <ESC>.  Both "txt_get_let" and "txt_get_str" append the NULL
  5037.        character to "str" as the final character if <ENTER> is pressed -- it
  5038.        is placed as the first characters if <ESC> is pressed or if <ENTER> is
  5039.        pressed with no input.  The cursor is shown during input and is hidden
  5040.        upon return (the cursor position is also restored upon return).
  5041.  
  5042.        "txt_get_num" accepts only numbers and the '+' and '-' and allows a
  5043.        maximum of six characters (five digits plus one sign) or a maximum of
  5044.        the number of digits "max"; if no sign prefixes the number, it is assumed
  5045.        to be positive.  This function stores a zero in "input" if <ESC> is
  5046.        pressed or if <ENTER> is pressed with no input.  "txt_getnum" will beep
  5047.        and prompt for a new entry if the user inputs a number less than -32768
  5048.        or greater than 32767.
  5049.  
  5050.        "txt_get_numu" accepts only numbers allows a maximum of five characters
  5051.        or a maximum of the number of digits "max".  This function stores a zero
  5052.        in "input" if <ESC> is pressed or if <ENTER> is pressed with no input.
  5053.        "txt_getnumu" will beep and prompt for a new entry if the user inputs a
  5054.        number greater than 65535.
  5055.  
  5056.        "txt_get_numl" accepts only numbers and the '+' and '-' and allows a
  5057.        maximum of eleven characters (ten digits plus one sign) or a maximum of
  5058.        the number of digits "max"; if no sign prefixes the number, it is assumed
  5059.        to be positive.  This function stores a zero in "input" if <ESC> is
  5060.        pressed or if <ENTER> is pressed with no input.  "txt_getnuml" will beep
  5061.        and prompt for a new entry if the user inputs a number less than
  5062.        -2 147 483 648 or greater than 2 147 483 647.
  5063.  
  5064.        "txt_get_numlu" accepts only numbers allows a maximum of eleven
  5065.        characters or a maximum of the number of digits "max".  This function
  5066.        stores a zero in "input" if <ESC> is pressed or if <ENTER> is pressed
  5067.        with no input.  "txt_getnumlu" will beep and prompt for a new entry if
  5068.        the user inputs a number greater than 4 294 967 295.
  5069.  
  5070. Return Value: = txt_get_let   - number of characters typed
  5071.                 txt_get_str   - -1 if <ESC> is pressed
  5072.               = txt_get_num
  5073.                 txt_get_numl
  5074.                 txt_get_numlu - number of digits typed
  5075.                 txt_get_numu  - -1 if <ESC> is pressed
  5076.  
  5077. ================================================================================
  5078. ----------------------------------  STRING  ------------------------------------
  5079.  
  5080. void txt_str_attr_show(byte x, byte y,
  5081.                        byte fgclr, byte bgclr, char *str, byte command);
  5082. Function: Print a string with attributes.
  5083.  
  5084. Arguments: = prints the string "str" in foreground color "fgclr" and
  5085.              background color "bgclr" at "x","y"
  5086.              - "command" determines how the string is printed
  5087.                - ALIGN_NONE     no command
  5088.                - ALIGN_HORZ     horizontal center; shifts odd lengths left
  5089.                - ALIGN_VERT     vertical center; shifts odd lengths up
  5090.                - ALIGN_CENTER   horizontal and vertical center
  5091.                - ALIGN_RIGHT    right justify; flush to the right margin
  5092.            = if "fgclr" = NO,  the foreground is not modified
  5093.            = if "bgclr" = NO, the background is not modified
  5094.  
  5095. Notes: The command "command" will revert to ALIGN_NONE if the length of string
  5096.        "str" is greater than 80 (the width of the text screen).  Only if "x"
  5097.        and "y" both equal TCUR, "txt_str_attr_show" advances the text cursor
  5098.        position to one past the last character printed.
  5099.  
  5100. See Also: txt_chr_attr_show txt_str_show txt_strattr_show
  5101.  
  5102. --------------------------------------------------------------------------------
  5103.                                                                           STRING
  5104. word txt_str_erase(byte x, byte y, char *str, byte command);
  5105. Function: Overwrite a string with spaces.
  5106.  
  5107. Arguments: = the string "str" at "x","y" is overwritten with spaces (ASCII 32)
  5108.            = "command" determines how the string is erased
  5109.              - ALIGN_NONE     no command
  5110.              - ALIGN_HORZ     horizontal center; shifts odd lengths left
  5111.              - ALIGN_VERT     vertical center; shifts odd lengths up
  5112.              - ALIGN_CENTER   horizontal and vertical center
  5113.              - ALIGN_RIGHT    right justify; flush to the right margin
  5114.  
  5115. Notes: The command "command" will revert to ALIGN_NONE if the length of the
  5116.        string "str" is greater than 80 (the width of the text screen).
  5117.  
  5118. Return Value: = length of "str"
  5119.  
  5120. See Also: txt_chrs_erase txt_erase txt_str_erase_pr txt_str_show
  5121.  
  5122. --------------------------------------------------------------------------------
  5123.                                                                           STRING
  5124. word txt_str_erase_pr(byte x, byte y, printdata *prdata);
  5125. Function: Overwrite "prdata.string" with spaces.
  5126.  
  5127. Arguments: = the string "prdata.string" at "x","y" is overwritten with spaces
  5128.              (ASCII 32)
  5129.              - if "x" = MEM, "prdata.x" is used
  5130.              - if "y" = MEM, "prdata.y" is used
  5131. Return Value: = length of "prdata.string"
  5132.  
  5133. See Also: txt_erase txt_print txt_str_erase
  5134.  
  5135. --------------------------------------------------------------------------------
  5136.                                                                           STRING
  5137. word txt_str_save(byte x, byte y, byte length, char *str, byte command);
  5138. Function: Read a string from the text screen.
  5139.  
  5140. Arguments: = reads "length" characters from "x","y" into "str"
  5141.              - if "length" = NULL, the length of "str" is used for the number of
  5142.                character to read
  5143.              - "command" determines how the string is read
  5144.                - ALIGN_NONE     no command
  5145.                - ALIGN_HORZ     horizontal center; shifts odd lengths left
  5146.                - ALIGN_VERT     vertical center; shifts odd lengths up
  5147.                - ALIGN_CENTER   horizontal and vertical center
  5148.                - ALIGN_RIGHT    right justify; flush to the right margin
  5149.  
  5150. Notes: The NULL character is appended as the last character to "str".
  5151.  
  5152. Return Value: = length of "str"
  5153.  
  5154. See Also: txt_str_show txt_attrs_save txt_chr_get txt_strattr_save
  5155.  
  5156. --------------------------------------------------------------------------------
  5157.                                                                           STRING
  5158. word txt_str_show(byte x, byte y, char *str, byte command);
  5159. Function: Print a string.
  5160.  
  5161. Arguments: = prints the string "str" at "x","y"
  5162.              - "command" determines how the string is printed
  5163.                - ALIGN_NONE     no command
  5164.                - ALIGN_HORZ     horizontal center; shifts odd lengths left
  5165.                - ALIGN_VERT     vertical center; shifts odd lengths up
  5166.                - ALIGN_CENTER   horizontal and vertical center
  5167.                - ALIGN_RIGHT    right justify; flush to the right margin
  5168.  
  5169. Notes: The command "command" will revert to ALIGN_NONE if the length of string
  5170.        "str" is greater than 80 (the width of the text screen).  Only if "x"
  5171.        and "y" both equal TCUR, "txt_str_show" advances the text cursor
  5172.        position to one past the last character printed.
  5173.  
  5174. Return Value: = length of "str"
  5175.  
  5176. See Also: txt_print txt_attrs_show txt_chr_show txt_str_attr_show
  5177.           txt_strattr_show txt_str_save txt_str_erase
  5178.  
  5179. --------------------------------------------------------------------------------
  5180.                                                                           STRING
  5181. word txt_strattr_need(byte length, byte height);
  5182.  
  5183. [see txt_attrs_need]
  5184.  
  5185. --------------------------------------------------------------------------------
  5186.                                                                           STRING
  5187. word txt_strattr_save(byte x, byte y, shortint length, textimagedata *strattr);
  5188. Function: Read a string with its attributes from the text screen.
  5189.  
  5190. Arguments: = reads length "length" characters and their attributes from
  5191.              "x","y" into "strattr"
  5192.              - if "length" = MEM, "strattr.length" is used
  5193.  
  5194. Notes: Make sure you have allocated enough memory to "strattr" by a call to
  5195.        "txt_strattr_need"; remember that each character requires TWO bytes
  5196.        (one for the character and one for its attribute).  The NULL character
  5197.        is appended as the last character to "strattr".  See Global Type
  5198.        Definitions for a description of the structure "textimagedata".
  5199.  
  5200. Return Value: = character count of "strattr" (which is length / 2)
  5201.  
  5202. See Also: txt_attrs_save txt_str_save txt_strattr_need txt_strattr_show
  5203.  
  5204. --------------------------------------------------------------------------------
  5205.                                                                           STRING
  5206. word txt_strattr_show(byte x, byte y, byte fgclr, byte bgclr,
  5207.                       textimagedata *strattr, byte command);
  5208. Function: Print a "txt_strattr_save"ed string with its attributes.
  5209.  
  5210. Arguments: = prints the string with attributes "strattr" at "x","y"
  5211.              - "command" determines how the string is printed
  5212.                - ALIGN_NONE     no command
  5213.                - ALIGN_HORZ     horizontal center; shifts odd lengths left
  5214.                - ALIGN_VERT     vertical center; shifts odd lengths up
  5215.                - ALIGN_CENTER   horizontal and vertical center
  5216.                - ALIGN_RIGHT    right justify; flush to the right margin
  5217.            = if "fgclr" = NO,  the foreground is not modified
  5218.                         = YES, modifies the foreground with the stored colors
  5219.                         = MEM, "attrs.fgclr" is used
  5220.            = if "bgclr" = NO, the background is not modified
  5221.                         = YES, modifies the background with the stored colors
  5222.                         = MEM, "attrs.bgclr" is used
  5223.  
  5224. Notes: The command "command" will revert to ALIGN_NONE if the length of string
  5225.        "strattr" is greater than 80 (the width of the text screen).  Only if
  5226.        "x" and "y" both equal TCUR, "txt_strattr_show" advances the text
  5227.        cursor position to one past the last character printed.  See Global
  5228.        Type Definitions for a description of the structure "textimagedata".
  5229.  
  5230. Return Value: = character count of "strattr" (which is length / 2)
  5231.  
  5232. See Also: txt_attrs_show txt_str_attr_show txt_chrs_erase txt_print
  5233.           txt_str_show txt_str_show txt_strattr_save
  5234.  
  5235. ================================================================================
  5236. ----------------------------------  WINDOW  ------------------------------------
  5237.  
  5238. word win_define(
  5239. Function: Define a new window.
  5240.  
  5241. Arguments: =
  5242.  
  5243. Notes: None.
  5244.  
  5245. Return Value: None.
  5246.  
  5247. See Also:
  5248.  
  5249. Example Program: None.
  5250.  
  5251. --------------------------------------------------------------------------------
  5252.                                                                           WINDOW
  5253. word win_move(
  5254. Function: Move a window to absolute coordinates.
  5255.  
  5256. Arguments: =
  5257.  
  5258. Notes: None.
  5259.  
  5260. Return Value: None.
  5261.  
  5262. See Also:
  5263.  
  5264. Example Program: None.
  5265.  
  5266. --------------------------------------------------------------------------------
  5267.                                                                           WINDOW
  5268. word win_move_rel(
  5269. Function: Move a window relative to its current position.
  5270.  
  5271. Arguments: =
  5272.  
  5273. Notes: None.
  5274.  
  5275. Return Value: None.
  5276.  
  5277. See Also:
  5278.  
  5279. Example Program: None.
  5280.  
  5281. --------------------------------------------------------------------------------
  5282.                                                                           WINDOW
  5283. word win_scroll(
  5284. Function: Scroll a window.
  5285.  
  5286. Arguments: =
  5287.  
  5288. Notes: None.
  5289.  
  5290. Return Value: None.
  5291.  
  5292. See Also:
  5293.  
  5294. Example Program: None.
  5295.  
  5296. ================================================================================
  5297.  
  5298.  
  5299. ==================================-----------===================================
  5300. ------------------------------------  VGA  -------------------------------------
  5301.                                   -----------
  5302. void fade_in(void);
  5303. Function:  Fade into a screen.
  5304.  
  5305. Notes: This usually follows a "fade_out".
  5306.  
  5307. See Also: fade_out
  5308.  
  5309. --------------------------------------------------------------------------------
  5310.                                                                              VGA
  5311. void txt_fade_out(void);
  5312. Function:  Fade a screen out to black.
  5313.  
  5314. Notes: This is usually followed by a "fade_in".
  5315.  
  5316. See Also: fade_in
  5317.  
  5318. --------------------------------------------------------------------------------
  5319.                                                                              VGA
  5320. boolean isit_color(void);
  5321. Function: Check if the current display adapter is color capable.
  5322.  
  5323. boolean isit_ega(void);
  5324. Function: Check if the current display adapter is EGA capable.
  5325.  
  5326. boolean isit_vga(void);
  5327. Function: Check if the current display adapter is VGA capable.
  5328.  
  5329. STILL UNDER DEVELOPMENT
  5330. boolean isit_svga(void);
  5331. Function: Check if the current display adapter is SuperVGA capable.
  5332.  
  5333. Notes: It is good practice to check if the desired display adapter is present
  5334.        before using it.
  5335.  
  5336. Return Value: = isit_color - TRUE if adapter is color capable
  5337.                            - FALSE if adapter is not color capable
  5338.               = isit_ega   - TRUE if adapter is EGA capable
  5339.                            - FALSE if adapter is not EGA capable
  5340.               = isit_vga   - TRUE if adapter is VGA capable
  5341.                            - FALSE if adapter is not VGA capable
  5342.               = isit_svga  - TRUE if adapter is SuperVGA capable
  5343.                            - FALSE if adapter is not SuperVGA capable
  5344.  
  5345. ================================================================================
  5346.  
  5347.  
  5348. =================================-------------==================================
  5349. -----------------------------------  VGA16  ------------------------------------
  5350.                                  -------------
  5351. void _16_boxfill(word x, word y, int length, int height, byte color, byte how);
  5352. Function: Draw a solid box.
  5353.  
  5354. void _16_boxfill_xy(word x1, word y1, word x2, word y2, byte color, byte how);
  5355.  
  5356. Arguments: = a box with one corner at "x","y", an x-length of "length",
  5357.              and a y-height of "height" is drawn in color "color"
  5358.            = "how" determines how the image is placed onto the screen
  5359.              - COPY_IMAGE   superimposes the box onto the screen
  5360.              - OR_IMAGE     performs a logical OR with the screen contents
  5361.              - AND_IMAGE    performs a logical AND with the screen contents
  5362.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  5363.              - COPY_IMAGE_SET   draws the image and sets to the current scroll
  5364.              - AND_IMAGE_SET    ANDs  the image and sets to the current scroll
  5365.              - OR_IMAGE_SET     ORs   the image and sets to the current scroll
  5366.              - XOR_IMAGE_SET    XORs  the image and sets to the current scroll
  5367.  
  5368. Notes: The x-length "length" and y-height "height" can be negative.
  5369.  
  5370. See Also: _16_boxoutline
  5371.  
  5372. Example Program: This program creates the background pattern using the
  5373. EXAMP006.EXE     procedure boxfill.
  5374.  
  5375. --------------------------------------------------------------------------------
  5376.                                                                            VGA16
  5377. void _16_boxoutline(int x, int y, int length, int height, int color,int how);
  5378. Function: Draw the outline of a box.
  5379.  
  5380. Arguments: = the outline of a box with one corner at "x","y", an x-length of
  5381.              "length", and a y-height of "height" is drawn in color "color"
  5382.            = "how" determines how the image is placed onto the screen
  5383.              - COPY_IMAGE   superimposes the box outline onto the screen
  5384.              - OR_IMAGE     performs a logical OR with the screen contents
  5385.              - AND_IMAGE    performs a logical AND with the screen contents
  5386.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  5387.              - COPY_IMAGE_SET   draws the image and sets to the current scroll
  5388.              - AND_IMAGE_SET    ANDs  the image and sets to the current scroll
  5389.              - OR_IMAGE_SET     ORs   the image and sets to the current scroll
  5390.              - XOR_IMAGE_SET    XORs  the image and sets to the current scroll
  5391.  
  5392. Notes: The x-length "length" and y-height "height" can be negative.
  5393.  
  5394. See Also: _16_boxfill
  5395.  
  5396. Example Program: This program creates the screen border using the procedure
  5397. EXAMP006.EXE     boxoutline.
  5398.  
  5399. --------------------------------------------------------------------------------
  5400.                                                                            VGA16
  5401. void _16_floodall(int color, int scroll);
  5402. Function: Flood the screen all one color.
  5403.  
  5404. Arguments: = the screen is filled with color "color"
  5405.            = "scroll" determines relative to what the flood will occur:
  5406.                                                    TRUE  - relative to screen
  5407.                                                   FALSE - relative to A000:0000
  5408. See Also: _16_floodallall
  5409.  
  5410. Example Program: This program floods the entire screen a select background
  5411. EXAMP006.EXE     color using the procedure floodall.
  5412.  
  5413. --------------------------------------------------------------------------------
  5414.                                                                            VGA16
  5415. void _16_floodallall(int color);
  5416. Function: Flood a 640x816 region of video memory all one color.
  5417.  
  5418. Arguments: = the video memory is filled with color "color"
  5419.  
  5420. Notes: The last three lines of video memory are left untouched.  The total
  5421.        video memory is actually 640x819.
  5422.  
  5423. See Also: _16_floodall
  5424.  
  5425. --------------------------------------------------------------------------------
  5426.                                                                            VGA16
  5427. STILL UNDER DEVELOPMENT
  5428. void _16_linebiglen(int x, int y, int length,
  5429.                     int height, int color, int how, int dimensions);
  5430. Function: Draw a line using specific blocks.
  5431.  
  5432. void _16_linebigxy(int x1, int y1, int x2, int y2,
  5433.                    int color, int how, int dimensions);
  5434. Function: Draw a line using specific blocks.
  5435.  
  5436. Arguments: = linebiglen - a line with one end at "x","y", x-length "length"
  5437.                           and y-height "height" is drawn in color "color"
  5438.            = linebigxy  - a line with one end at "x1","y1" and the other end
  5439.                           at "x2","y2" is drawn in color "color"
  5440.            = "how" determines how the image is placed onto the screen
  5441.              - COPY_IMAGE   superimposes the box outline onto the screen
  5442.              - OR_IMAGE     performs a logical OR with the screen contents
  5443.              - AND_IMAGE    performs a logical AND with the screen contents
  5444.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  5445.              - COPY_IMAGE_SET   draws the image and sets to the current scroll
  5446.              - AND_IMAGE_SET    ANDs  the image and sets to the current scroll
  5447.              - OR_IMAGE_SET     ORs   the image and sets to the current scroll
  5448.              - XOR_IMAGE_SET    XORs  the image and sets to the current scroll
  5449.            = a line is drawn using the specific block size "dimensions"
  5450.  
  5451. Notes: These procedures are identical to "linelen"/"linexy", except they draw
  5452.        a line using a specific block size instead of pixels.  The dimensions
  5453.        of each block must be less than 9 and greater than 0.
  5454.  
  5455. See Also: _16_linelen _16_linexy
  5456.  
  5457. --------------------------------------------------------------------------------
  5458.                                                                            VGA16
  5459. void _16_linelen(int x, int y, int length, int height, int color, int how);
  5460. Function: Draw a line.
  5461.  
  5462. void _16_linexy(int x1, int y1, int x2, int y2, int color, int how);
  5463. Function: Draw a line.
  5464.  
  5465. Arguments: = linelen - a line with one end at "x","y", x-length "length" and
  5466.                        y-height "height" is drawn in color "color"
  5467.            = linexy  - a line with one end at "x1","y1" and the other end at
  5468.                        "x2","y2" is drawn in color "color"
  5469.            = "how" determines how the image is placed onto the screen
  5470.              - COPY_IMAGE   superimposes the box outline onto the screen
  5471.              - OR_IMAGE     performs a logical OR with the screen contents
  5472.              - AND_IMAGE    performs a logical AND with the screen contents
  5473.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  5474.              - COPY_IMAGE_SET   draws the image and sets to the current scroll
  5475.              - AND_IMAGE_SET    ANDs  the image and sets to the current scroll
  5476.              - OR_IMAGE_SET     ORs   the image and sets to the current scroll
  5477.              - XOR_IMAGE_SET    XORs  the image and sets to the current scroll
  5478. See Also: _16_linebiglen _16_linebigxy
  5479.  
  5480. --------------------------------------------------------------------------------
  5481.                                                                            VGA16
  5482. void _16_pixel(int x, int y, int color, int scroll);
  5483. Function: Change the color of a pixel.
  5484.  
  5485. Arguments: = the pixel at coordinates "x","y" is changed to color "color"
  5486.            = "scroll" determines relative to what the pixel will be set:
  5487.                                                    TRUE  - relative to screen
  5488.                                                    FALSE - relative to A000:0000
  5489.  
  5490. See Also: _16_pixel_avg _16_pixel_color _16_pixel_is _16_thermal
  5491.  
  5492. --------------------------------------------------------------------------------
  5493.                                                                            VGA16
  5494. int _16_pixel_avg(int x, int y, int scroll);
  5495. Function: Return the average color of the nine pixels surrounding a point.
  5496.  
  5497. Arguments: = pixels surrounding the coordinate "x","y" and the pixel at "x","y"
  5498.              are averaged
  5499.            = "scroll" determines relative to what the pixel will be read:
  5500.                                                    TRUE  - relative to screen
  5501.                                                    FALSE - relative to A000:0000
  5502.  
  5503. Return Value: = average color of pixels surrounding "x","y"
  5504.  
  5505. See Also: _16_pixel
  5506.  
  5507. --------------------------------------------------------------------------------
  5508.                                                                            VGA16
  5509. int _16_pixel_color(int x, int y, int scroll);
  5510. Function: Read the color a pixel.
  5511.  
  5512. Arguments: = the pixel at coordinates "x","y" is read
  5513.            = "scroll" determines relative to what the pixel will be read:
  5514.                                                    TRUE  - relative to screen
  5515.                                                    FALSE - relative to A000:0000
  5516. Return Value: = color of the pixel at "x","y"
  5517.  
  5518. See Also: _16_pixel
  5519.  
  5520. --------------------------------------------------------------------------------
  5521.                                                                            VGA16
  5522. boolean _16_pixel_is(int x, int y, int color, int scroll);
  5523. Function: Check if a pixel is a certain color.
  5524.  
  5525. Arguments: = the pixel at coordinates "x","y" is compared to color "color"
  5526.            = "scroll" determines relative to what the pixel will be checked:
  5527.                                                    TRUE  - relative to screen
  5528.                                                    FALSE - relative to A000:0000
  5529.  
  5530. Notes: This function is a combination of the pixel_color function and a
  5531.        comparison statement.
  5532.  
  5533. Return Value: = TRUE if pixel "x","y" is color "color"
  5534.               = FALSE if pixel "x","y" is not color "color"
  5535.  
  5536. See Also: _16_pixel
  5537.  
  5538. --------------------------------------------------------------------------------
  5539.                                                                            VGA16
  5540. int _16_popupcolumn(int x, int y, int choice,
  5541.             int maxopts, char *ptr[], int mousepresent);
  5542. Function: Pop up a column in graphics mode.
  5543.  
  5544. Arguments: = the top-left corner of the column is located at "x", "y".
  5545.            = the option number "choice" is active
  5546.              - the first menu is 1, the next is 2, etc.
  5547.              - if you always want it to start at the top of the available
  5548.                menus, make "choice" always equal to 1
  5549.        = there are "maxopts" options available
  5550.          - there is no maximum for this value
  5551.        = "ptr" is an array of char pointers to all of the options
  5552.            = "mousepresent" == TRUE if a mouse is present (it must have been
  5553.              initialized with a call to "ms_init()") or FALSE is not present
  5554.              - if a mouse is present, the left mouse button selects an option
  5555.                just as <ENTER> selects that option using the keyboard and the
  5556.                right mouse button cancels, just as <ESC> does through the
  5557.                keyboard
  5558.              - the keyboard commands can also be used
  5559.  
  5560. Notes: This function is a simpler version of the function "popupmenu" and has
  5561.        the advantage of an unlimited number of choices (as opposed to 16 for
  5562.        "popupmenu").  It is ideal for lists of options, such as a directory
  5563.        listing.
  5564.  
  5565. Return Value: = -1 if unable to allocate sufficient memory to hold a copy of the
  5566.                    part of the screen that would be overwritten.
  5567.               = FALSE if the user aborted his selection
  5568.               = if a selection was made, the number is returned (top being 1)
  5569.  
  5570. See Also: _16_popupmenu
  5571.  
  5572. --------------------------------------------------------------------------------
  5573.                                                                            VGA16
  5574. int _16_popupmenu(int x, int y, int choice, int maxmenus,
  5575.           char *ptr[], int data[][3], char *text[], int mousepresent);
  5576. Function: Pop up a menu in graphics mode.
  5577.  
  5578. Arguments: = the top-left corner of the menu is located at "x", "y".
  5579.            = the menu number "choice" is active
  5580.              - the first menu is 1, the next is 2, etc.
  5581.              - in the example program, if "choice" equalled 4, the highlighted
  5582.                menu would be DOS.
  5583.              - if you always want it to start at the top of the available
  5584.                menus, make "choice" always equal to 1
  5585.            = there are "maxmenus" menus available
  5586.          - there is a maximum of 16 menu possible
  5587.              - in the example program, "maxmenus" would equal 4
  5588.        = "ptr" is an array of pointers to all of the menus
  5589.            = "data" holds necessary information about the "text" array of
  5590.              pointers.
  5591.              - its three arrays are, in respective order:
  5592.                [number of submenus accessed from the corresponding menu]
  5593.                [index into *text]
  5594.                [1 = submenu active, 0 = submenu inactive, determined through
  5595.                     bit positions from right to left]
  5596.            = "text" holds all of the submenus and dictates which menus are
  5597.              available to the user (menus that are unavailable will appear
  5598.              RED and the user will not be able to select them
  5599.            = "mousepresent" == TRUE if a mouse is present (it must have been
  5600.              initialized with a call to "ms_init()") or FALSE is not present
  5601.              - if a mouse is present, the left mouse button selects an option
  5602.                just as <ENTER> selects that option using the keyboard and the
  5603.                right mouse button cancels, just as <ESC> does through the
  5604.                keyboard
  5605.              - the keyboard commands can also be used
  5606.  
  5607. In Example (ie):
  5608.  
  5609. char *ptr[] = { "FILE", "PRINT", "SORT", "DOS" };     /* menus              */
  5610. char *text[] = {                                      /* submenu options    */
  5611.    (char *)0x000B,                                    /* see NOTE 1         */
  5612.    "NEW", "LOAD", SAVE",                              /* submenus of menu 1 */
  5613.    "BLOCK", "ENTIRE DOCUMENT", "EXTERNAL FILE",       /* submenus of menu 2 */
  5614.    "EXIT TO", "SHELL TO"                              /* submenus of menu 4 */
  5615. };
  5616. int data[][3] = { { 3,  1, 0x0007 },          /* corresponds to first menu  */
  5617.                   { 3,  4, 0x0004 },          /* see NOTE 2                 */
  5618.                   { 0,  0, 0x0000 },          /* corresponds to third menu  */
  5619.                   { 2,  7, 0x0003 }           /* corresponds to fourth menu */
  5620. };                  ^   ^
  5621.                     |   +----- the index into "text"
  5622.                     +--------- the number of submenus
  5623. NOTE 1 - the numerical equivalent of the hexadecimal digit B is 1011
  5624.        - from right to left, each binary digit represents a menu
  5625.        - the rightmost digit represents the menu FILE, designating it active
  5626.        - the second-to-the-right digit represents the menu PRINT, designating
  5627.          it active
  5628.        - the second-to-the-left digit represents the menu SORT, designating
  5629.          it inactive
  5630.        - the leftmost digit represents the menu DOS, designating it active
  5631.        - the rest of the hexadecimal digits are ignored as there are only
  5632.          four menus as will be specified by the "maxmenus" parameter when
  5633.          popupmenu will be called
  5634.  
  5635. NOTE 2 - the numerical equivalent for the hexadecimal digit 4 is 0100
  5636.        - from right to left, each binary digit represents a submenu
  5637.        - the rightmost digit represents the submenu BLOCK, designating it
  5638.          inactive
  5639.        - the second-to-the-right digit represents the submenu ENTIRE DOCUMENT,
  5640.          designating it inactive
  5641.        - the second-to-the-left digit represents the submenu EXTERNAL FILE,
  5642.          designating it active
  5643.        - the last bit, and the rest of the hexadecimal digits, are ignored as
  5644.          there are only 3 submenus as specified by the first number of that
  5645.          array cell
  5646.  
  5647.    DECIMAL TO HEXADECIMAL TO BINARY CONVERSION TABLE:
  5648.    +---------------+------+------+------+------+------+------+------+------+
  5649.    | DECIMAL DIGIT |  0   |  1   |  2   |  3   |  4   |  5   |  6   |  7   |
  5650.    +---------------+------+------+------+------+------+------+------+------+
  5651.    | HEX DIGIT     |  0   |  1   |  2   |  3   |  4   |  5   |  6   |  7   |
  5652.    +---------------+------+------+------+------+------+------+------+------+
  5653.    | BINARY DIGIT  | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |
  5654.    =========================================================================
  5655.    | DECIMAL DIGIT |  8   |  9   |  10  |  11  |  12  |  13  |  14  |  15  |
  5656.    +---------------+------+------+------+------+------+------+------+------+
  5657.    | HEX DIGIT     |  8   |  9   |  A   |  B   |  C   |  D   |  E   |  F   |
  5658.    +---------------+------+------+------+------+------+------+------+------+
  5659.    | BINARY DIGIT  | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
  5660.    +---------------+------+------+------+------+------+------+------+------+
  5661.  
  5662. Notes: This is a very useful procedure that prompts for the user's response
  5663.        using a unique menu system.  The menu pops up onto the screen and, when
  5664.        the user makes his choice, restores the screen.  If the user presses
  5665.        the <ESC> key or, if the mouse is active, presses the right mouse
  5666.        button the menu closes and no selection is registered.
  5667.  
  5668. Return Value: = -1 if unable to allocate sufficient memory to hold a copy of the
  5669.                    part of the screen that would be overwritten.
  5670.               = FALSE if the user aborted his selection
  5671.               = if a selection was made, the
  5672.                 - first four bits represent the submenu that was selected
  5673.                   where "NEW" and "EXTERNAL FILE" were submenus
  5674.                   - if "NEW" was selected, the return would be 1
  5675.                   - if "EXTERNAL FILE" was selected, the return would be 3
  5676.                 - second four bits represent the menu that was selected where
  5677.                   "FILE" and "SORT" were menus
  5678.                   - if "FILE" was selected, the return would be 1
  5679.                   - if "SORT" was selected, the return would be 3
  5680.  
  5681. See Also: _16_popupcolumn
  5682.  
  5683. Example Program: Creates a simple menu system of common program options.  The
  5684.                  user can scroll through the menu options with the keyboard
  5685. EXAMP002.EXE     or, if a mouse was detected, with the mouse.  If the user
  5686.                  selects File-Load, some options will be enabled (as in common
  5687.                  applications) and if the user selects File-New, some options
  5688.                  will be disabled (also as in common applications).  Below is
  5689.                  an ASCII example of the form of the menu system:
  5690.  
  5691.        +---------------------------------+
  5692.        |==FILE===   NEW    LOAD    SAVE  |
  5693.        |  PRINT  +-----------------------+
  5694.        |  SORT   |
  5695.        |  DOS    |
  5696.        +---------+
  5697.  
  5698.        If the user pressed the down arrow:
  5699.  
  5700.        +---------+    *** REMEMBER  the second and third menu are currently
  5701.        |  FILE   |                  unavailable; that is why they were skipped
  5702.        |  PRINT  |
  5703.        |  SORT   +-----------------------+
  5704.        |==DOS====   EXIT TO    SHELL TO  |
  5705.        +---------+-----------------------+
  5706.  
  5707.        If the user pressed the right arrow:
  5708.  
  5709.        +---------+
  5710.        |  FILE   +
  5711.        |  PRINT  |
  5712.        |  SORT   +-----------------------+
  5713.        |  DOS    |==EXIT=TO==  SHELL TO  |
  5714.        +---------+-----------------------+
  5715.  
  5716.        *** NOTE   THIS IS NOT A WYSIWYG (What You See Is What You Get)
  5717.                   THE GRAPHICS MODE REPRESENTATION IS MUCH BETTER
  5718.  
  5719. --------------------------------------------------------------------------------
  5720.                                                                            VGA16
  5721. int _16_scrollevel(void);
  5722. Function: Read the number of rows currently scrolled.
  5723.  
  5724. Arguments: = None
  5725.  
  5726. Return Value: = number of rows currently scrolled
  5727.  
  5728. --------------------------------------------------------------------------------
  5729.                                                                            VGA16
  5730. void _16_scrollrow(int rows);
  5731. Function: Scroll the screen a specific number of rows.
  5732.  
  5733. Arguments: = "rows" rows are scrolled
  5734.              - if positive, scrolls down
  5735.              - if negative, scrolls up
  5736.              - if zero, restores video pointer to A000:0000 (default)
  5737.  
  5738. Notes: Use "scrollrow" for smooth full-screen vertical scrolling.
  5739.  
  5740. --------------------------------------------------------------------------------
  5741.                                                                            VGA16
  5742. void _16_thermal(int x, int y, int length, int height);
  5743. Function: Generate a thermal equilibrium style spread.
  5744.  
  5745. Arguments: = each pixel inside the region with one corner at "x","y", an
  5746.              x-length of "length", and y-height of "height" is changed to the
  5747.              average color of its surrounding pixels [see _16_pixel_avg]
  5748.            = "scroll" determines relative to what the spread will begin:
  5749.                                                    TRUE  - relative to screen
  5750.                                                    FALSE - relative to A000:0000
  5751.  
  5752. See Also: _16_pixel
  5753.  
  5754. ================================================================================
  5755. ---------------------------------  ANIMATION  ----------------------------------
  5756.  
  5757. void _16_animat(void *x_y_maxx_maxy, int newx, int newy, int index,
  5758.           imagedata *graphor[], imagedata *graph[], imagedata *segment[]);
  5759. Function: Animate any "_16_i_save"ed image.
  5760.  
  5761. Arguments: = the coordinates and dimensions of the image to move reside in
  5762.              the structure or array "x_y_maxx_maxy"
  5763.            = "graphor" points to the all-white version of the image
  5764.            = "graph" points to the true-color version of the image
  5765.            = the image addressed by the array "graph" and "graphor" with the
  5766.              index "index" will be moved to "newx","newy"
  5767.            = the background is stored in segment "segment"
  5768.              - the background must have an x-width of 640, but can have a
  5769.                variable y-height
  5770.  
  5771. Notes: "_16_animat" replaces the following four commands
  5772.          _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bg_screen);
  5773.          _16_i_show(newx, newy, OR_IMAGE, icon1_graphor[pic]);
  5774.          _16_i_show(newx, newy, XOR_IMAGE, icon1_graphor[pic]);
  5775.          _16_i_show(newx, newy, OR_IMAGE, icon1_graph[pic]);
  5776.        into one more efficient procedure.
  5777.  
  5778.        This animating image flashes white (as in the example program).  This
  5779.        was my first attempt at an animation procedure, so it works only on
  5780.        relatively small images.  It can be used for unusual effects.  See
  5781.        Global Type Definitions for a description of the structure "imagedata".
  5782.  
  5783. See Also: _16_animat_rect _16_animat_bss _16_animat_bvs _16_animat_p
  5784.  
  5785. Example Program: EXAMP001.EXE
  5786.  
  5787. --------------------------------------------------------------------------------
  5788.                                                                        ANIMATION
  5789. void _16_animate_rect(int *x_y_maxx_maxy, int newx, int newy,
  5790.               int index, imagedata *graph[], imagedata *segment[]);
  5791. Function: Animate any solid rectangular "_16_i_save"ed image.
  5792.  
  5793. Arguments: = the coordinates and dimensions of the image to move reside in
  5794.              the structure or array "x_y_maxx_maxy"
  5795.            = the image addressed by the array "graph" with the index "index"
  5796.              will be moved to "newx","newy"
  5797.            = the background is stored at segment "segment"
  5798.              - the background must have an x-width of 640, but can have a
  5799.                variable y-height
  5800.  
  5801. Notes: Use this procedure for animating solid rectangular "_16_i_save"ed images
  5802.        It was specifically designed for this form of animation, replacing
  5803.          _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bg_screen);
  5804.          _16_i_show(newx, newy, COPY_IMAGE, icon1_graph[pic]);
  5805.        into one more efficient procedure.  See Global Type Definitions for a
  5806.        description of the structure "imagedata".
  5807.  
  5808. See Also: _16_animat _16_animat_bss _16_animat_bvs _16_animat_p
  5809.  
  5810. Example Program: EXAMP001.EXE
  5811.  
  5812. --------------------------------------------------------------------------------
  5813.                                                                        ANIMATION
  5814. void _16_animat_bss(int oldx, int oldy, int newx, int newy,
  5815.                  imagedata *oldgraph, imagedata *graph, imagedata *segment[]);
  5816. Function: Animate any "_16_c_save"ed image.
  5817.  
  5818. Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
  5819.            = the image "oldgraph" is at "oldx","oldy"
  5820.            = the image "graph" will be located at "newx","newy"
  5821.            = the background is stored in segment "segment"
  5822.              - the background must have an x-width of 640, but can have a
  5823.                variable y-height
  5824.  
  5825. Notes: One row of the background is restored, then one row of the image is
  5826.        written.  Because only one line of the background is restored at a
  5827.        time, there is much less flicker than restoring the entire background
  5828.        under an image and then writing the image. For higher speed animation,
  5829.        use "_16_animat_bvs".  See Global Type Definitions for a description of
  5830.        the structure "imagedata".
  5831.  
  5832. See Also: _16_animat _16_animat_rect _16_animat_bvs _16_animat_p
  5833.  
  5834. Example Program: EXAMP001.EXE
  5835.  
  5836. --------------------------------------------------------------------------------
  5837.                                                                        ANIMATION
  5838. STILL UNDER DEVELOPMENT
  5839.  
  5840. void _16_animat_bvs(int oldx, int oldy, int newx, int newy,
  5841.                     int id, imagedata *oldgraph, imagedata *graph[]);
  5842. Function: Animate any "_16_c_save"ed image at 32-bit speed.
  5843.  
  5844. Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
  5845.            = each unique image requires a unique identification number "id"
  5846.              (it is a constant that should not change
  5847.            = the image "oldgraph" is at "oldx","oldy"
  5848.            = the image "graph" will be located at "newx","newy"
  5849.            = the background is stored in segment "segment"
  5850.              - the background must have an x-width of 640, but can have a
  5851.                variable y-height
  5852.  
  5853. Notes: Two global arrays required: "memoryidentity" and "memoryaddress"
  5854.          unsigned int memoryidentity[MAXGRAPHICS];
  5855.          void         *memoryaddress[MAXGRAPHICS];
  5856.          DO NOT MODIFY THESE ARRAYS -- THEY ARE USED BY THE ASSEMBLER ROUTINES
  5857.          "memoryidentity" is a unique graphic number for each separate image
  5858.          "memoryaddress"  is an array of video memory offsets for each image
  5859.        See the example program for a working version.
  5860.  
  5861.        This procedure reads the images to animate from the invisible portions
  5862.        of the video RAM and transfers the images to the visible portions of
  5863.        video RAM through the internal 32-bit data path of the EGA/VGA card.
  5864.        The disadvantage is that there is only 217088 bytes of video RAM
  5865.        available, as opposed to 655360 bytes of system RAM.  For slower
  5866.        transfers, but more memory, use the procedures that transfer the
  5867.        images from system RAM to video RAM 16-bits at a time.  See Global Type
  5868.        Definitions for a description of the structure "imagedata".
  5869.  
  5870. See Also: _16_animat _16_animat_rect _16_animat_bss _16_animat_p
  5871.  
  5872. Example Program: None yet.
  5873.  
  5874. --------------------------------------------------------------------------------
  5875.                                                                        ANIMATION
  5876. void _16_animat_p(void *x_y_maxx_maxy, int newx, int newy,
  5877.           int index, imagedata *graph[], imagedata *segment[]);
  5878. Function: Animate any "_16_p_save"ed image.
  5879.  
  5880. Arguments: = the coordinates and dimensions of the image to move reside in
  5881.              the structure or array "x_y_maxx_maxy"
  5882.            = the image addressed by the array "graph" with the index "index"
  5883.              will be moved to "newx","newy"
  5884.            = the background is stored in segment "segment"
  5885.              - the background must have an x-width of 640, but can have a
  5886.                variable y-height
  5887.  
  5888. Notes: This procedure replaces the following
  5889.          _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bgscreen);
  5890.          _16_p_show(newx, newy, icon1_graphor[pic]);
  5891.        into one more efficient procedure.  See Global Type Definitions for a
  5892.        description of the structure "imagedata".
  5893.  
  5894. See Also: _16_animat _16_animat_rect _16_animat_bss _16_animat_bvs
  5895.  
  5896. Example Program: EXAMP001.EXE
  5897.  
  5898. ================================================================================
  5899. -----------------------------------  IMAGE  ------------------------------------
  5900.  
  5901. void _16_copy(imagedata *destination, imagedata *source);
  5902. Function: Copy any "_16_c_save"ed, "_16_i_save"ed, or "_16_p_save"ed image.
  5903.  
  5904. Arguments: = "source" is copied into "destination"
  5905.  
  5906. Notes: Both "destination" and "source" must be either "_16_c_save"ed,
  5907.        "_16_i_save"ed, or "_16_p_save"ed images -- "_16_copy" does not convert
  5908.        between the three formats.  Make certain "destination" has been been
  5909.        allocated sufficient memory to hold "source".  See Global Type
  5910.        Definitions for a description of the structure "imagedata".
  5911.  
  5912. See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
  5913.  
  5914. Example Program: EXAMP001.EXE
  5915.  
  5916. --------------------------------------------------------------------------------
  5917.                                                                            IMAGE
  5918. STILL UNDER DEVELOPMENT
  5919. void _16_move(int oldx, int oldy, int newx, int newy,
  5920.               int id, imagedata *oldgraph, imagedata *graph[]);
  5921. Function: Move any "_16_c_save"ed image 32-bits at a time.
  5922.  
  5923. Arguments: = the image at "oldx","oldy" will be moved to "newx","newy"
  5924.            = each unique image requires a unique identification number "id"
  5925.              (it is a constant that should not change
  5926.            = the image "oldgraph" is at "oldx","oldy"
  5927.            = the image "graph" will be located at "newx","newy"
  5928.            = the background is stored in segment "segment"
  5929.              - the background must have an x-width of 640, but can have a
  5930.                variable y-height
  5931.  
  5932. Notes: Two global arrays required: "memoryidentity" and "memoryaddress"
  5933.          unsigned int memoryidentity[MAXGRAPHICS];
  5934.          void         *memoryaddress[MAXGRAPHICS];
  5935.          DO NOT MODIFY THESE ARRAYS -- THEY ARE USED BY THE ASSEMBLER ROUTINES
  5936.          "memoryidentity" is a unique graphic number for each separate image
  5937.          "memoryaddress"  is an array of video memory offsets for each image
  5938.        See the example program for a working version.
  5939.  
  5940.        This procedure reads the images to animate from the invisible portions
  5941.        of the video RAM and transfers the images to the visible portions of
  5942.        video RAM through the internal 32-bit data path of the EGA/VGA card.
  5943.        The disadvantage is that there is only 217088 bytes of video RAM
  5944.        available, as opposed to 655360 bytes of system RAM.  For slower
  5945.        transfers, but more memory, use the procedures that transfer the
  5946.        images from system RAM to video RAM 16-bits at a time.  When this
  5947.        procedure is written, it will provide the fastest graphic moves.  See
  5948.        Global Type Definitions for a description of the structure "imagedata".
  5949.  
  5950. See Also: _16_c_move _16_i_move _16_p_move
  5951.  
  5952. Example Program: None yet.
  5953.  
  5954. = === === === === === === === === === === === === === === === === === === === ==
  5955. ------------------------------  COMPRESS IMAGE  --------------------------------
  5956.  
  5957. void _16_c_move(int oldx, int oldy, int newx, int newy,
  5958.                 imagedata *oldgraph, imagedata *graph, imagedata *segment[]);
  5959. Function: Move any "_16_c_save"ed image.
  5960.  
  5961. Arguments: = the image at "oldx","oldy" is moved to "newx","newy"
  5962.            = the old image "oldgraph" is at "oldx","oldy"
  5963.            = the new image "graph" becomes located at "newx","newy"
  5964.            = the background is stored in segment "segment"
  5965.              - the background must have an x-width of 640, but can have a
  5966.                variable y-height
  5967.  
  5968. Notes: One row of the background is restored, then one row of the image is
  5969.        written.  Because only one line of the background is restored at a
  5970.        time, there is much less flicker than restoring the entire background
  5971.        under an image and then writing the image.  This procedure provides the
  5972.        slowest graphic moves. See Global Type Definitions for a description of
  5973.        the structure "imagedata".
  5974.  
  5975. See Also: _16_i_move _16_p_move _16_move
  5976.  
  5977. Example Program: EXAMP001.EXE
  5978.  
  5979. --------------------------------------------------------------------------------
  5980.                                                                   COMPRESS IMAGE
  5981. unsigned int _16_c_need_scrn(int left, int top, int length, int height);
  5982. Function: Calculate the memory requirement of a "_16_c_save"ed image that is
  5983.           onscreen.
  5984.  
  5985. Arguments: = calculates for an image with top-left at "left","top" and an
  5986.              x-length "length" and y-height "height"
  5987.  
  5988. Notes: Use "_16_c_need_scrn" to determine the number of bytes to allocate to
  5989.        store a specific onscreen image.  See "_16_c_need_wrst" to store a
  5990.        theoretical image.
  5991.  
  5992. Return Value: = memory requirement in bytes
  5993.  
  5994. See Also: _16_c_need_wrst _16_c_save _16_i_need _16_p_need
  5995.  
  5996. Example Program: EXAMP001.EXE
  5997.  
  5998. --------------------------------------------------------------------------------
  5999.                                                                   COMPRESS IMAGE
  6000. unsigned int _16_c_need_wrst(int length, int height);
  6001. Function: Calculate the worst-case memory requirement of any "_16_c_save"ed
  6002.           image (in other words, zero percent compression).
  6003.  
  6004. Arguments: = calculates for an image of x-length "length" and y-height
  6005.              "height"
  6006.  
  6007. Notes: Use "_16_c_need_wrst" to determine the number of bytes to allocate to
  6008.        store a theoretical image with "_16_c_save".  See "_16_c_need_scrn" to
  6009.        store an onscreen image.
  6010.  
  6011. Return Value: = memory requirement in bytes
  6012.  
  6013. See Also: _16_c_need_scrn _16_c_save _16_i_need _16_p_need
  6014.  
  6015. Example Program: EXAMP001.EXE
  6016.  
  6017. --------------------------------------------------------------------------------
  6018.                                                                   COMPRESS IMAGE
  6019. int _16_c_percent(imagedata *image);
  6020. Function: Calculate how much percent smaller (or larger) a "_16_c_save"ed
  6021.           image is, compared to a "_16_p_save"ed image.
  6022.  
  6023. Arguments: = compressed image "image" is used in the calculation
  6024.  
  6025. Notes: If the return value is less than 100, the compressed image is smaller
  6026.        than the equivalent uncompressed image -- if it is greater than 100,
  6027.        the image would be smaller if stored with "_16_p_save".  For examppe,
  6028.        if the returned value was 40, the compressed image is 60% smaller than
  6029.        the equivalent "_16_p_save"ed image (this is the average).  See Global
  6030.        Type Definitions for a description of the structure "imagedata".
  6031.  
  6032. Return Value: = percentage smaller (or larger) the compressed image is
  6033.  
  6034. See Also: _16_c_save _16_i_save _16_p_save
  6035.  
  6036. Example Program: EXAMP001.EXE
  6037.  
  6038. --------------------------------------------------------------------------------
  6039.                                                                   COMPRESS IMAGE
  6040. STILL UNDER DEVELOPMENT
  6041. int _16_c_read_off(imagedata *image, int offset);
  6042. Function: Read the color of a pixel by an offset.
  6043.  
  6044. Arguments: = pixel number "offset" is read from the image "image"
  6045.  
  6046. Notes: "_16_c_read_off" is used for offset-based reads of a pixel's color
  6047.        where the first pixel is at offset 0.  Pixels are numbered from left to
  6048.        right, top to bottom.  For coordinate-based reads, see "_16_c_read_xy".
  6049.        See Global Type Definitions for a description of the structure
  6050.        "imagedata".
  6051.  
  6052. Return Value: = color of the addressed pixel
  6053.  
  6054. See Also: _16_c_read_xy _16_i_read_off _16_p_read_off
  6055.  
  6056. --------------------------------------------------------------------------------
  6057.                                                                   COMPRESS IMAGE
  6058. STILL UNDER DEVELOPMENT
  6059. int _16_c_read_xy(imagedata *image, int x, int y);
  6060. Function: Read the color of a pixel by a coordinate.
  6061.  
  6062. Arguments: = pixel addressed by "x","y" is read from the image "image"
  6063.  
  6064. Notes: "_16_c_read_xy" is used for coordinate-based reads of a pixel's color.
  6065.        For offset-based reads, see "_16_c_read_off".  See Global Type
  6066.        Definitions for a description of the structure "imagedata".
  6067.  
  6068. Return Value: = color of the addressed pixel
  6069.  
  6070. See Also: _16_c_read_off _16_i_read_xy _16_p_ready_xy
  6071.  
  6072. --------------------------------------------------------------------------------
  6073.                                                                   COMPRESS IMAGE
  6074. void _16_c_save(int left, int top, int length, int height,
  6075.     int transparency_color, imagedata *image, unsigned int size, int how);
  6076. Function: Store an image from the screen using compression.
  6077.  
  6078. Arguments: = the image with top-left "left","top", x-length "length", y-height
  6079.              "height", transparency color "transparency_color", and byte size
  6080.              "size" is stored into the memory location "image"
  6081.              - if byte size "size" = FALSE, the size will be calculated by a
  6082.                call to "_16_c_need_scrn"
  6083.            = "how" determines if the image will be saved relative to the
  6084.              current scroll or not
  6085.              - TRUE    image is saved relative to the scroll
  6086.              - FALSE   image is saved relative to A000:0000
  6087.  
  6088. Notes: All of the given parameters are written to the "imagedata" structure.
  6089.        The transparency color is the color that represents the "holes" in the
  6090.        graphic where the background will show through.  "_16_c_save" is faster
  6091.        if the byte size "size" is given.  The compression algorithm creates
  6092.        about 60% smaller data as opposed to no compression.  However,
  6093.        "_16_c_save" (and "_16_c_show") are the slowest at handling images.
  6094.        Make certain enough memory has been allocated to store the image.  See
  6095.        Global Type Definitions for a description of the structure "imagedata".
  6096.  
  6097. See Also: _16_c_need_scrn _16_c_need_wrst _16_c_show _16_i_save _16_p_save
  6098.  
  6099. Example Program: EXAMP001.EXE
  6100.  
  6101. --------------------------------------------------------------------------------
  6102.                                                                   COMPRESS IMAGE
  6103. void _16_c_show(int x, int y, imagedata *image, byte how);
  6104. Function: Write any "_16_c_save"ed image to the screen.
  6105.  
  6106. Arguments: = the top-left corner of the image "image" will be at "x","y"
  6107.              - if "x" = -1, "imagedata.x" is used for the abscissa
  6108.              - if "y" = -1, "imagedata.y" is used for the ordinate
  6109.            = "how" determines how the image is placed onto the screen
  6110.              - COPY_IMAGE   superimposes the box outline onto the screen
  6111.              - OR_IMAGE     performs a logical OR with the screen contents
  6112.              - AND_IMAGE    performs a logical AND with the screen contents
  6113.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  6114.  
  6115. Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
  6116.        "imagedata.y", respectively.  The bit "imagedata.how" determines if the
  6117.        image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
  6118.        See Global Type Definitions for a description of the structure
  6119.        "imagedata".
  6120.  
  6121. See Also: _16_c_save _16_i_show _16_p_show
  6122.  
  6123. Example Program: EXAMP001.EXE
  6124.  
  6125. --------------------------------------------------------------------------------
  6126.                                                                   COMPRESS IMAGE
  6127. STILL UNDER DEVELOPMENT
  6128. void _16_i_to_c(imagedata *destination_c, imagedata *source_i);
  6129. Function: Convert any "_16_i_save"ed image to a "_16_c_save"ed image.
  6130.  
  6131. Arguments: = "_16_i_save"ed format "source_i" is converted to "_16_c_save"ed
  6132.              format "destination_c"
  6133.  
  6134. Notes: This procedure is equivalent to performing a "_16_i_show" and a
  6135.        "_16_c_save" (without modifying the video memory).  See Global Type
  6136.        Definitions for a description of the structure "imagedata".
  6137.  
  6138. See Also: _16_c_to_i _16_c_to_p _16_i_to_p _16_p_to_c _16_p_to_i
  6139.  
  6140. --------------------------------------------------------------------------------
  6141.                                                                   COMPRESS IMAGE
  6142. STILL UNDER DEVELOPMENT
  6143. void _16_p_to_c(imagedata *destination_c, imagedata *source_p);
  6144. Function: Convert any "_16_p_save"ed image to a "_16_c_save"ed image.
  6145.  
  6146. Arguments: = "_16_p_save"ed format "source_p" is converted to "_16_c_save"ed
  6147.              format "destination_c"
  6148.  
  6149. Notes: This procedure is equivalent to performing a "_16_p_show" and a
  6150.        "_16_c_save" (without modifying the video memory).  See Global Type
  6151.        Definitions for a description of the structure "imagedata".
  6152.  
  6153. See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_i
  6154.  
  6155. = === === === === === === === === === === === === === === === === === === === ==
  6156. --------------------------------  PIXEL IMAGE  ---------------------------------
  6157.  
  6158. STILL UNDER DEVELOPMENT
  6159. void _16_c_to_p(imagedata *destination_p, imagedata *source_c);
  6160. Function: Convert any "_16_c_save"ed image to a "_16_p_save"ed image.
  6161.  
  6162. Arguments: = "_16_c_save"ed format "source_c" is converted to "_16_p_save"ed
  6163.              format "destination_p"
  6164.  
  6165. Notes: This procedure is equivalent to performing a "_16_c_show" and a
  6166.        "_16_p_save" (without modifying the video memory).  See Global Type
  6167.        Definitions for a description of the structure "imagedata".
  6168.  
  6169. See Also: _16_c_to_i _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
  6170.  
  6171. --------------------------------------------------------------------------------
  6172.                                                                      PIXEL IMAGE
  6173. STILL UNDER DEVELOPMENT
  6174. void _16_i_to_p(imagedata *destination_p, imagedata *source_i);
  6175. Function: Convert any "_16_i_save"ed image to a "_16_p_save"ed image.
  6176.  
  6177. Arguments: = "_16_i_save"ed format "source_i" is converted to "_16_p_save"ed
  6178.              format "destination_p"
  6179.  
  6180. Notes: This procedure is equivalent to performing a "_16_i_show" and a
  6181.        "_16_p_save" (without modifying the video memory).  See Global Type
  6182.        Definitions for a description of the structure "imagedata".
  6183.  
  6184. See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_p_to_c _16_p_to_i
  6185.  
  6186. --------------------------------------------------------------------------------
  6187.                                                                      PIXEL IMAGE
  6188. void _16_p_move(void *x_y_maxx_maxy, int newx, int newy,
  6189.                 int index, imagedata *graph[], imagedata *segment[]);
  6190. Function: Move any "_16_p_save"ed image.
  6191.  
  6192. Arguments: = the coordinates and dimensions of the image to move reside in
  6193.              the structure or array "x_y_maxx_maxy"
  6194.            = the image addressed by the array "graph" with the index "index"
  6195.              will be moved to "newx","newy"
  6196.            = the background is stored in segment "segment"
  6197.              - the background must have an x-width of 640, but can have a
  6198.                variable y-height
  6199.  
  6200. Notes: This procedure replaces the following
  6201.          _16_restore_bg(icon.x, icon.y, icon.maxx, icon.maxy, bgscreen);
  6202.          _16_p_show(newx, newy, icon1_graphor[pic]);
  6203.        into one more efficient procedure.
  6204.        This procedure currently provides the third fastest graphic moves.  See
  6205.        Global Type Definitions for a description of the structure "magedata".
  6206.  
  6207. See Also: _16_c_move _16_i_move _16_move
  6208.  
  6209. Example Program: EXAMP001.EXE
  6210.  
  6211. --------------------------------------------------------------------------------
  6212.                                                                      PIXEL IMAGE
  6213. unsigned int _16_p_need(int length, int height);
  6214. Function: Calculate the memory requirement of any "_16_p_save"ed image.
  6215.  
  6216. Arguments: = calculates for an image of x-length "length" and y-height
  6217.          "height"
  6218.  
  6219. Notes: Use "_16_p_need" to determine the number of bytes to allocate to store
  6220.        an image with "_16_p_save".
  6221.  
  6222. Return Value: = memory requirement in bytes
  6223.  
  6224. See Also: _16_c_need_scrn _16_c_need_wrst _16_i_need _16_p_save
  6225.  
  6226. Example Program: EXAMP001.EXE
  6227.  
  6228. --------------------------------------------------------------------------------
  6229.                                                                      PIXEL IMAGE
  6230. int _16_p_read_off(imagedata *image, int offset);
  6231. Function: Read the color of a pixel by an offset.
  6232.  
  6233. Arguments: = pixel number "offset" is read from the image "image"
  6234.  
  6235. Notes: "_16_p_read_off" is used for offset-based reads of a pixel's color
  6236.        where the first pixel is at offset 0.  Pixels are numbered from left to
  6237.        right, top to bottom.  For coordinate-based reads, see "_16_p_read_xy".
  6238.        See Global Type Definitions for a description of the structure
  6239.        "imagedata".
  6240.  
  6241. Return Value: = color of the addressed pixel's color
  6242.  
  6243. See Also: _16_c_read_off _16_i_read_off _16_p_ready_xy
  6244.  
  6245. --------------------------------------------------------------------------------
  6246.                                                                      PIXEL IMAGE
  6247. int _16_p_read_xy(imagedata *image, int x, int y);
  6248. Function: Read the color of a pixel by a coordinate.
  6249.  
  6250. Arguments: = pixel addressed by "x","y" is read from the graphic object
  6251.              addressed by "image"
  6252.  
  6253. Notes: "_16_p_read_xy" is used for coordinate-based reads of a pixel's color.
  6254.        For offset-based reads, see "_16_p_read_off".  See Global Type
  6255.        Definitions for a description of the structure "imagedata".
  6256.  
  6257. Return Value: = color of the addressed pixel's color
  6258.  
  6259. See Also: _16_c_read_xy _16_i_read_xy _16_p_ready_off
  6260.  
  6261. --------------------------------------------------------------------------------
  6262.                                                                      PIXEL IMAGE
  6263. void _16_p_save(int left, int top, int length, int height,
  6264.      int transparency_color, imagedata *image, unsigned int size, int how);
  6265. Function: Store an image from the screen based on a pixel by pixel algorithm.
  6266.  
  6267. Arguments: = the image with top-left "left","top", x-length "length", y-height
  6268.              "height", transparency color "transparency_color", and byte size
  6269.              "size" is stored into the memory location "image"
  6270.          - if byte size "size" = 0, the size will be calculated by a call
  6271.                to "_16_p_need"
  6272.            = "how" determines if the image will be saved relative to the
  6273.              current scroll or not
  6274.              - TRUE    image is saved relative to the scroll
  6275.              - FALSE   image is saved relative to A000:0000
  6276.  
  6277. Notes: All of the given parameters are written to the "imagedata" structure.
  6278.        The transparency color is the color that represents the "holes" in the
  6279.        graphic where the background will show through.  "_16_p_save" is faster
  6280.        if the byte size "size" is given.  This procedure (and "_16_p_show")
  6281.        are the second fastest at handling images.  Make certain enough memory
  6282.        has been allocated to store the image.  See Global Type Definitions for
  6283.        a description of the structure "imagedata".
  6284.  
  6285. See Also: _16_c_save _16_i_save _16_p_need _16_p_show
  6286.  
  6287. Example Program: EXAMP001.EXE
  6288.  
  6289. --------------------------------------------------------------------------------
  6290.                                                                      PIXEL IMAGE
  6291. void _16_p_show(int x, int y, imagedata *image, byte how);
  6292. Function: Write any "_16_p_save"ed image to the screen.
  6293.  
  6294. Arguments: = the top-left corner of the image "image" will be at "x","y"
  6295.              - if "x" = -1, "imagedata.x" is used for the abscissa
  6296.              - if "y" = -1, "imagedata.y" is used for the ordinate
  6297.            = "how" determines how the image is placed onto the screen
  6298.              - COPY_IMAGE   superimposes the box outline onto the screen
  6299.              - OR_IMAGE     performs a logical OR with the screen contents
  6300.              - AND_IMAGE    performs a logical AND with the screen contents
  6301.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  6302.  
  6303. Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
  6304.        "imagedata.y", respectively.  The bit "imagedata.how" determines if the
  6305.        image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
  6306.        See Global Type Definitions for a description of the structure
  6307.        "imagedata".
  6308.  
  6309. See Also: _16_c_show _16_i_show _16_p_save
  6310.  
  6311. Example Program: EXAMP001.EXE
  6312.  
  6313. = === === === === === === === === === === === === === === === === === === === ==
  6314. --------------------------------  PLANE IMAGE  ---------------------------------
  6315.  
  6316. STILL UNDER DEVELOPMENT
  6317. void _16_c_to_i(imagedata *destination_i, imagedata *source_c);
  6318. Function: Convert any "_16_c_save"ed image to a "_16_i_save"ed image.
  6319.  
  6320. Arguments: = "_16_c_save"ed format "source_c" is converted to "_16_i_save"ed
  6321.              format "destination_i"
  6322.  
  6323. Notes: This procedure is equivalent to performing a "_16_c_show" and a
  6324.        "_16_i_save" (without modifying the video memory).  See Global Type
  6325.        Definitions for a description of the structure "imagedata".
  6326. See Also: _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c _16_p_to_i
  6327.  
  6328. --------------------------------------------------------------------------------
  6329.                                                                      PLANE IMAGE
  6330. void _16_i_move(int oldx, int oldy, int newx, int newy,
  6331.              imagedata *oldgraph[], imagedata *graph[], imagedata *segment[]);
  6332. Function: Move any "_16_i_save"ed image.
  6333.  
  6334. void _16_i_move_rect(int oldx, int oldy, int newx, int newy,
  6335.              imagedata *oldgraph[], imagedata *graph[], imagedata *segment[]);
  6336. Function: Move any solid rectangular "_16_i_save"ed image.
  6337.  
  6338. Arguments: = the image at "oldx","oldy" is moved to "newx","newy"
  6339.            = the old image "oldgraph" is at "oldx","oldy"
  6340.              - "oldgraph[0]" is the full-color graphic and "oldgraph[1]" is the
  6341.                full-black version of the graphic
  6342.            = the new image "graph" becomes located at "newx","newy"
  6343.              - "graph[0]" is the full-color graphic and "graph[1]" is the
  6344.                full-black version of the graphic
  6345.            = the background is stored in segment "segment"
  6346.              - the background must have an x-width of 640, but can have a
  6347.                variable y-height
  6348.  
  6349. Notes: One row of the background is restored, then one row of the image is
  6350.        written.  Because only one line of the background is restored at a
  6351.        time, there is much less flicker than restoring the entire background
  6352.        under an image and then writing the image.  This procedure currently
  6353.        provides the second fastest graphic moves.  See Global Type Definitions
  6354.        for a description of the structure "imagedata".
  6355.  
  6356. See Also: _16_c_move _16_p_move _16_move
  6357.  
  6358. Example Program: EXAMP001.EXE
  6359.  
  6360. --------------------------------------------------------------------------------
  6361.                                                                      PLANE IMAGE
  6362. unsigned int _16_i_need(int length, int height);
  6363. Function: Calculate the memory requirement of any "_16_i_save"ed image.
  6364.  
  6365. Arguments: = calculates for an image of x-length "length" and y-height
  6366.              "height"
  6367.  
  6368. Notes: Use "_16_i_need" to determine the number of bytes to allocate to store
  6369.        an image with "_16_i_save".
  6370.  
  6371. Return Value: = memory requirement in bytes
  6372.  
  6373. See Also: _16_c_need_scrn _16_c_need_wrst _16_i_save _16_p_need
  6374.  
  6375. Example Program: EXAMP001.EXE
  6376.  
  6377. --------------------------------------------------------------------------------
  6378.                                                                      PLANE IMAGE
  6379. int _16_i_read_off(imagedata *image, int offset);
  6380. Function: Read the color of a pixel an offset.
  6381.  
  6382. Arguments: = pixel number "offset" is read from the image "image"
  6383.  
  6384. Notes: "_16_i_read_off" is used for offset-based reads of a pixel's color
  6385.        where the first pixel is at offset 0.  Pixels are numbered from left to
  6386.        right, top to bottom.  For coordinate-based reads, see "_16_i_read_xy".
  6387.        See Global Type Definitions for a description of the structure
  6388.        "imagedata".
  6389.  
  6390. Return Value: = color of the addressed pixel
  6391.  
  6392. See Also: _16_c_read_off _16_i_read_xy _16_p_read_off
  6393.  
  6394. --------------------------------------------------------------------------------
  6395.                                                                      PLANE IMAGE
  6396. int _16_i_read_xy(imagedata *image, int x, int y);
  6397. Function: Read the color of a pixel coordinate.
  6398.  
  6399. Arguments: = pixel addressed by "x","y" is read from the image "image"
  6400.  
  6401. Notes: This function is used for coordinate-based reads of a pixel's color.
  6402.        For offset-based reads, see "_16_i_read_off".
  6403.  
  6404. Return Value: = color of the addressed pixel
  6405.  
  6406. See Also: _16_c_read_xy _16_i_read_off _16_p_ready_xy
  6407.  
  6408. --------------------------------------------------------------------------------
  6409.                                                                      PLANE IMAGE
  6410. void _16_i_save(int left, int top, int length, int height,
  6411.                 imagedata *image, unsigned int size, int how);
  6412. Function: Store an image from the screen based on a plane by plane algorithm.
  6413.  
  6414. Arguments: = the image with top-left "left","top", x-length "length", y-height
  6415.              "height", and byte size "size" is stored into the memory location
  6416.              "image"
  6417.              - if byte size "size" = 0, the size will be calculated by a call
  6418.                to "_16_i_need"
  6419.            = "how" determines if the image will be saved relative to the
  6420.              current scroll or not
  6421.              - TRUE    image is saved relative to the scroll
  6422.              - FALSE   image is saved relative to A000:0000
  6423.  
  6424. Notes: All of the given parameters are written to the "imagedata" structure.
  6425.        The "imagedata" structure will filled with information about "image".
  6426.        "_16_i_save" is faster if the byte size "size" is given.  This
  6427.        procedure (and "_16_i_show") are the fastest at handling images.  Make
  6428.        certain enough memory has been allocated to store the image.  See
  6429.        Global Type Definitions for a description of the structure "imagedata".
  6430.  
  6431. See Also: _16_c_save _16_i_need _16_i_show _16_p_save
  6432.  
  6433. Example Program: EXAMP001.EXE
  6434.  
  6435. --------------------------------------------------------------------------------
  6436.                                                                      PLANE IMAGE
  6437. void _16_i_show(int x, int y, imagedata *image, byte how);
  6438. Function: Write any "_16_i_save"ed image to the screen.
  6439.  
  6440. Arguments: = the top-left corner of the image "image" will be at "x","y"
  6441.              - if "x" = -1, "imagedata.x" is used for the abscissa
  6442.              - if "y" = -1, "imagedata.y" is used for the ordinate
  6443.            = "how" determines how the image is placed onto the screen
  6444.              - COPY_IMAGE   superimposes the box outline onto the screen
  6445.              - OR_IMAGE     performs a logical OR with the screen contents
  6446.              - AND_IMAGE    performs a logical AND with the screen contents
  6447.              - XOR_IMAGE    performs logical exclusive-OR with screen contents
  6448.  
  6449. Notes: If "x" or "y" do not equal -1, they will be saved in "imagedata.x" and
  6450.        "imagedata.y", respectively.  The bit "imagedata.how" determines if the
  6451.        image is shown relative to the screen (TRUE) or to A000:0000 (FALSE).
  6452.        See Global Type Definitions for a description of the structure
  6453.        "imagedata".
  6454.  
  6455. See Also: _16_c_show _16_i_save _16_p_show
  6456.  
  6457. Example Program: EXAMP001.EXE
  6458.  
  6459. --------------------------------------------------------------------------------
  6460.                                                                      PLANE IMAGE
  6461. STILL UNDER DEVELOPMENT
  6462. void _16_p_to_i(imagedata *destination_i, imagedata *source_p);
  6463. Function: Convert any "_16_p_save"ed image to a "_16_i_save"ed image.
  6464.  
  6465. Arguments: = "_16_p_save"ed format "source_p" is converted to "_16_i_save"ed
  6466.              format "destination_i"
  6467.  
  6468. Notes: This procedure is equivalent to performing a "_16_p_show" and a
  6469.        "_16_i_save" (without modifying the video memory).  See Global Type
  6470.        Definitions for a description of the structure "imagedata".
  6471.  
  6472. See Also: _16_c_to_i _16_c_to_p _16_i_to_c _16_i_to_p _16_p_to_c
  6473.  
  6474. --------------------------------------------------------------------------------
  6475.                                                                      PLANE IMAGE
  6476. void _16_restore_bg(int left, int top,
  6477.                     int length, int height, imagedata *segment[]);
  6478. Function: Restore a section of the background.
  6479.  
  6480. Arguments: = the portion of the background with its top-left corner at
  6481.              "left","top" and x-length "length" and y-height "height" is
  6482.              restored
  6483.            = the background is stored in segment "segment"
  6484.              - the background must have an x-width of 640, but can have a
  6485.                variable y-height
  6486.  
  6487. Notes: The bit "imagedata.how" determines if the image is shown relative to
  6488.        the screen (TRUE) or relative to A000:0000 (FALSE).  These instructions
  6489.        store the 640x816 background in memory location "segment"
  6490.           _16_i_save(0, 0,   640, 204, bgscrn[0], FALSE, FALSE);
  6491.           _16_i_save(0, 204, 640, 204, bgscrn[1], FALSE, FALSE);
  6492.           _16_i_save(0, 408, 640, 204, bgscrn[2], FALSE, FALSE);
  6493.           _16_i_save(0, 612, 640, 204, bgscrn[3], FALSE, FALSE);
  6494.        See Global Type Definitions for a description of the structure
  6495.        "imagedata".
  6496.  
  6497. Example Program: EXAMP001.EXE
  6498.  
  6499. ================================================================================
  6500.  
  6501.  
  6502. =================================--------------=================================
  6503. -----------------------------------  VGA256  -----------------------------------
  6504.                  --------------
  6505. void _256_pixel(int x, int y, int color, int scroll);
  6506. Function: Change the color of a pixel.
  6507.  
  6508. Arguments: = the pixel at coordinates "x","y" is changed to color "color"
  6509.            = "scroll" determines relative to what the pixel will be set:
  6510.                                                    TRUE  - relative to screen
  6511.                                                   FALSE - relative to A000:0000
  6512. --------------------------------------------------------------------------------
  6513.                                                                           VGA256
  6514. void _256_floodall(int color, int scroll);
  6515. Function: Flood the screen all one color.
  6516.  
  6517. Arguments: = the screen is filled with color "color"
  6518.            = "scroll" determines relative to what the flood will occur:
  6519.                                                    TRUE  - relative to screen
  6520.                                                   FALSE - relative to A000:0000
  6521. ================================================================================
  6522.  
  6523.  
  6524. ======================== END OF LIBRARY DOCUMENTATION ==========================
  6525.  
  6526. ------------------------------------------------------------------------------
  6527.                                   DISCLAIMER
  6528. To the best of my ability (and that is damn good), I have made the enclosed
  6529. programs error free and compatible with all IBM PC clones from the 8088 up to
  6530. the Pentium.  I cannot be held accountable for the behavior of the enclosed
  6531. programs or files and assume no liability for damages either from the direct
  6532. use or as a consequence of the use/misuse of this product.  Hence, this
  6533. program and all information contained within should be used at one's own risk.
  6534.  
  6535. This disclaimer is included to absolve me from the legal issues brought about
  6536. by today's litigious society.
  6537.  
  6538. --------------------------------------------------------------------------------
  6539.  
  6540. If you have ANY comments or questions regarding this library or any other
  6541. programs authored by me, George Vanous, feel free to reach me via email at
  6542.   vanous@helix.net
  6543. or call me at (604)589-2675 or write to me:  George Vanous
  6544.                                              8930 Watson Court
  6545.                                              Delta, BC
  6546.                                              V4C 4T6
  6547.  
  6548. REALiTY
  6549.